public static bool Save(Template template, ref string sXml, bool bValidate)
        {
            //Convert the xml into an xmldocument
            XmlDocument xmlTemplateDoc = new XmlDocument();
            xmlTemplateDoc.PreserveWhitespace = false;
            xmlTemplateDoc.LoadXml(sXml);

            //Convert the objects stored in memory to an xmldocument
            XmlDocument xmlDoc = new XmlDocument();
            XmlElement rootITATDocuments = xmlDoc.CreateElement(XMLNames._E_Documents);

            //unload the documents so that they get reloaded with the latest xml on the Documents accessor.
            template.UnloadDocuments();

            if (template.Documents != null)
                foreach (ITATDocument document in template.Documents)
                {
                    XmlElement elementITATDocument = xmlDoc.CreateElement(XMLNames._E_Document);
                    document.Build(xmlTemplateDoc, xmlDoc, elementITATDocument, bValidate);
                    rootITATDocuments.AppendChild(elementITATDocument);
                }

            //Replace the impacted portion of the complete xml with this version from memory
            XmlNode importedRootITATDocument = xmlTemplateDoc.ImportNode(rootITATDocuments, true);
            //Find the "Terms" child node
            XmlNode documentsChildNode = xmlTemplateDoc.SelectSingleNode(Utility.XMLHelper.GetXPath(true, XMLNames._E_TemplateDef, XMLNames._E_Documents));
            XmlNode documentChildNode = xmlTemplateDoc.SelectSingleNode(Utility.XMLHelper.GetXPath(true, XMLNames._E_TemplateDef, XMLNames._E_Document));

            if (documentChildNode != null)
            {
                xmlTemplateDoc.DocumentElement.RemoveChild(documentChildNode);
                xmlTemplateDoc.DocumentElement.AppendChild(importedRootITATDocument);
            }
            else if (documentsChildNode != null)
                xmlTemplateDoc.DocumentElement.ReplaceChild(importedRootITATDocument, documentsChildNode);
            else
                xmlTemplateDoc.DocumentElement.AppendChild(importedRootITATDocument);

            //Store the entire xml back to the database
            sXml = xmlTemplateDoc.OuterXml;

            return true;
        }