Proper and elegant way of Building a XML Document I need to build the following XML document

&lt;?xml version="1.0"?&gt;
&lt;SFDocument&gt;
    &lt;TableID&gt;5415&lt;/TableID&gt;
    &lt;PageSize&gt;1&lt;/PageSize&gt;
    &lt;PageIndex&gt;1&lt;/PageIndex&gt;
    &lt;MultiCompany&gt;No&lt;/MultiCompany&gt;
    &lt;Language&gt;1033&lt;/Language&gt;
    &lt;Fields&gt;
        &lt;Field&gt;Operation No.&lt;/Field&gt;
        &lt;Field&gt;Line No.&lt;/Field&gt;
        &lt;Field&gt;Date&lt;/Field&gt;
        &lt;Field&gt;Comment&lt;/Field&gt;
    &lt;/Fields&gt;
    &lt;TableFilters&gt;
        &lt;TableFilter&gt;
            &lt;Field&gt;Status&lt;/Field&gt;
            &lt;Filter&gt;3&lt;/Filter&gt;
        &lt;/TableFilter&gt;
        &lt;TableFilter&gt;
            &lt;Field&gt;Prod. Order No.&lt;/Field&gt;
            &lt;Filter&gt;101006&lt;/Filter&gt;
        &lt;/TableFilter&gt;
    &lt;/TableFilters&gt;
    &lt;Key&gt;
        &lt;Field&gt;Routing Reference No&lt;/Field&gt;
        &lt;Field&gt;10000&lt;/Field&gt;
    &lt;/Key&gt;
&lt;/SFDocument&gt;


using the following code, it works but is it the proper way of doing it.

internal class Field
{
    public string Name { get; set; }
    public  const string FieldName = "Field";
}
internal class Key
{
    public string Field { get; set; }
    public  const string FieldName = "Field";
}

internal class TableFilter
{
    public string Field { get; set; }
    public string Filter { get; set; }
    public const string FieldName = "Field";
    public const string FilterName = "FilterName";
} 

void Main()
{
    //this part is just for the example, obviously, this would be passed as parameter
    var tableId = 5415;
    var pageSize = 1;
    var pageIndex = 1;
    var multiCompany = "No";
    var language = 1033;

    var fields = new List&lt;Field&gt;();
    fields.Add(new Field() {Name = "Operation No."});
    fields.Add(new Field() {Name = "Line No."});
    fields.Add(new Field() {Name = "Date"});
    fields.Add(new Field() {Name = "Comment"});

    var tableFilters = new List&lt;TableFilter&gt;();
    tableFilters.Add(new TableFilter() {Field = "Status", Filter = "3"});
    tableFilters.Add(new TableFilter() {Field = "Prod. Order No.", Filter = "101006"});

    var keys = new List&lt;Key&gt;();
    keys.Add(new Key() {Field = "Routing Reference No"});
    keys.Add(new Key() {Field = "10000"});

    //End of setup

    XDocument doc = new XDocument(new XElement("SFDocument",
                                      new XElement("TableId", tableId), 
                                      new XElement("PageSize", pageSize),
                                      new XElement("PageIndex", pageIndex),
                                      new XElement("MultiCompany", multiCompany),
                                      new XElement("Language", language),
                                      new XElement("Fields"),
                                        new XElement("TableFilters"),
                                        new XElement("Key")
                                        )
    );

    var xFields = doc.Element("SFDocument").Element("Fields");

    foreach (Field field in fields)
    {
        xFields.Add(new XElement(Field.FieldName, field.Name));
    }

    var xTableFilters = doc.Element("SFDocument").Element("TableFilters");

    foreach (TableFilter tableFilter in tableFilters)
    {
        var tf = new XElement("TableFilter");
        tf.Add(new XElement(TableFilter.FieldName, tableFilter.Field));
        tf.Add(new XElement(TableFilter.FilterName, tableFilter.Filter  ));
        xTableFilters.Add(tf);
    }

    var xKey = doc.Element("SFDocument").Element("Key");

    foreach (Key key in keys)
    {
        xKey.Add(new XElement(Key.FieldName, key.Field));
    }       
    doc.Dump();  //Using LinqPad
}
I ended up changing my approach and went with a serialize method:

public static class SerializationHelper
{
    internal static string SerializeObject&lt;T&gt;(this T toSerialize)
    {
        var xmlSerializer = new XmlSerializer(toSerialize.GetType());
        var textWriter = new StringWriter();
        xmlSerializer.Serialize(textWriter, toSerialize);
        return textWriter.ToString();
    }
}
[Serializable]
public class SFDocument
{
    public int TableId { get; set; }
    public int PageSize { get; set; }
    public int PageIndex { get; set; }
    public string MultiCompany { get; set; }
    public int Language { get; set; }

        [XmlArrayItem("Field")]
        public List&lt;string&gt; Fields { get; set; }

        public List&lt;TableFilter&gt; TableFilters { get; set; }

        [XmlArrayItem("Field")]
        public List&lt;string&gt; Key { get; set; }
        public SFDocument(): this(5415, 1, 1, "No", 1033){}

        public SFDocument(int tableId, int pageSize, int pageIndex, string multiCompany, int language)
        {
            TableId = tableId;
            PageSize = pageSize;
            PageIndex = pageIndex;
            MultiCompany = multiCompany;
            Language = language;

            Fields = new List&lt;string&gt;();
            Key = new List&lt;string&gt;();
            TableFilters  = new List&lt;TableFilter&gt;();
        }
}   

[Serializable]
public class TableFilter
{
    public string Field { get; set; }
    public string Filter { get; set; }

    public TableFilter() {}

    public TableFilter(string field, string filter)
    {
        Field = field;
        Filter = filter;
    }
}

void Main()
{
    var sfd = new SFDocument();
    sfd.Fields.Add("Field1");
    sfd.Fields.Add("Field2");
    sfd.Fields.Add("Field3");
    sfd.Fields.Add("Field4");

    sfd.Key.Add("Key1");
    sfd.Key.Add("Key2");
    sfd.Key.Add("Key3");

    sfd.TableFilters.Add(new TableFilter("field1", "filter1"));
    sfd.TableFilters.Add(new TableFilter("field2", "filter2"));
    sfd.TableFilters.Add(new TableFilter("field3", "filter3"));
    sfd.SerializeObject().Dump();
}