Currently there is not way to save the template library using TemplateLibrary class.
You can try using .NET XmlDocument class to read, create new elements and save the XML file and use the InRoads.xsd schema file to help you validate your XML file.
I hope…