title: Creating xml with xdocument
body: <p>I want create xml file of this structure:</p>
  
  <pre><code> &lt;Devices&gt;
     &lt;Device Number="58" Name="Default Device" &gt;
       &lt;Functions&gt;
           &lt;Function Number="1" Name="Default func" /&gt;
           &lt;Function Number="2" Name="Default func2" /&gt;
           &lt;Function Number="..." Name="...." /&gt;
       &lt;/Functions&gt;
     &lt;/Device&gt;
   &lt;/Devices&gt;
  </code></pre>
  
  <p>Here's my code:</p>
  
  <pre><code>document.Element("Devices").Add(
  new XElement("Device",
  new XAttribute("Number", ID),
  new XAttribute("Name", Name),
  new XElement("Functions")));
  </code></pre>
  
  <p>Each object "device" have List&lt;> of "functions", how can i add "functions" to xml???</p>