Writing a MaterialInstanceConstant object to a UAsset file in C++

What I’m trying to do is load a template material that I have saved, edit some parameter values, such as the texture sample, and then save it back as a material file. I’m making an editor plugin, so I don’t need this to work at runtime or anything. I’ve got the loading and editing part working by using a MaterialInstanceConstant, but I’m having trouble saving it again as a different uasset file. How can I accomplish this?