public string ToXml() { StringBuilder XmlBuilder = new StringBuilder(); if (IsChild == false) { XmlBuilder.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?><Input>"); } else { XmlBuilder.Append("<Child>"); } XmlBuilder.Append("<From>" + From + "</From>"); XmlBuilder.Append("<Entity name=\"" + Name + "\">"); XmlBuilder.Append("<Action>" + OperationAction.ToString() + "</Action>"); XmlBuilder.Append("<PKSourceField name=\"opportunityid\">" + this.PKSourceID + "</PKSourceField><PKDestinationField name=\"new_sfdcrenewalopportunityid\">" + this.PKDestinationID + "</PKDestinationField>"); XmlBuilder.Append("<Data>"); foreach (Field Childfield in Fields) { XmlBuilder.Append(Childfield.ToXml()); } XmlBuilder.Append("</Data>"); XmlBuilder.Append("<Childs>"); foreach (SyncEntity Ch in ChildEntity) { XmlBuilder.Append(Ch.ToXml()); } XmlBuilder.Append("</Childs>"); XmlBuilder.Append("</Entity>"); if (IsChild == false) { XmlBuilder.Append("</Input>"); } else { XmlBuilder.Append("</Child>"); } return(XmlBuilder.ToString()); }