ToXElement() public method

Converts a given ChangeSetHistory into an T:XElement.
public ToXElement ( ChangeSetHistory changeSetHistory ) : XElement
changeSetHistory ChangeSetHistory The to convert.
return XElement
        /// <summary>
        /// Converts a given <see cref="Account"/> into an <see cref="T:XElement"/>.
        /// </summary>
        /// <param name="account">The <see cref="Account"/> to convert.</param>
        /// <returns>The newly created <see cref="T:XElement"/>.</returns>
        public XElement ToXElement(Account account)
        {
            XElement element = new XElement(account.AccountType.ToString());
            element.Add(new XElement("AccountID", account.AccountID));
            element.Add(new XElement("CreatedByUsername", account.CreatedByUsername));
            element.Add(new XElement("CreatedDate", account.CreatedDate));
            element.Add(new XElement("Description", account.Description));
            element.Add(new XElement("Name", account.Name));
            element.Add(new XElement("UpdatedByUsername", account.UpdatedByUsername));
            element.Add(new XElement("UpdatedDate", account.UpdatedDate));

            // Append the change history
            ChangeSetHistoryXElementAdapter adapter = new ChangeSetHistoryXElementAdapter();
            element.Add(adapter.ToXElement(account.ChangeSetHistory));

            return element;
        }
        /// <summary>
        /// Converts a given <see cref="Transaction"/> into an <see cref="T:XElement"/>.
        /// </summary>
        /// <param name="transaction">The <see cref="Transaction"/> to convert.</param>
        /// <returns>The newly created <see cref="T:XElement"/>.</returns>
        public XElement ToXElement(Transaction transaction)
        {
            XElement element = new XElement("Transaction");
            element.Add(new XElement("DebitAccountID", transaction.DebitAccount.AccountID));
            element.Add(new XElement("CreditAccountID", transaction.CreditAccount.AccountID));
            element.Add(new XElement("CreatedByUsername", transaction.CreatedByUsername));
            element.Add(new XElement("CreatedDate", transaction.CreatedDate));
            element.Add(new XElement("Date", transaction.Date));
            element.Add(new XElement("Particulars", transaction.Particulars));
            element.Add(new XElement("TransactionID", transaction.TransactionID));
            element.Add(new XElement("Value", transaction.Value));
            element.Add(new XElement("UpdatedByUsername", transaction.UpdatedByUsername));
            element.Add(new XElement("UpdatedDate", transaction.UpdatedDate));

            // Append the change history
            ChangeSetHistoryXElementAdapter adapter = new ChangeSetHistoryXElementAdapter();
            element.Add(adapter.ToXElement(transaction.ChangeSetHistory));

            return element;
        }