title: Linq XML to Object, where xml nodes have nested elements
body: <p>I need to generate a <code>List&lt;Event&gt;</code> from a XML document, and the <code>Event</code> has a <code>List&lt;Contact&gt;</code>. How can I convert the XML to a <code>List&lt;Event&gt;</code> object when reading:</p>
  
  <p>This is my event class:</p>
  
  <pre><code>public class Event
  {
      public string id { get; set; }
      public string title { get; set; }
      public DateTime Start { get; set; }
      public DateTime End { get; set; }
      public virtual List&lt;Contact&gt; contacts { get; set; }
  }
  </code></pre>
  
  <p>Contact class</p>
  
  <pre><code>public class Contact
  {
  
      public int Id { get; set; }
      public string Name { get; set; }
  }
  </code></pre>
  
  <p>This is how I save the XML document when the user adds something.</p>
  
  <pre><code>&lt;Event&gt;
      &lt;id&gt;1&lt;/id&gt;
      &lt;title&gt;AA&lt;/title&gt;
      &lt;start&gt;2019-12-01T14:13:58.863&lt;/start&gt;
      &lt;end&gt;2019-12-01T15:13:58.787&lt;/end&gt;
      &lt;contacts&gt;
  
        &lt;contact&gt;
          &lt;id&gt;1&lt;/id&gt;
          &lt;name&gt;ABC&lt;/name&gt;
        &lt;/contact&gt;
  
        &lt;contact&gt;
          &lt;id&gt;2&lt;/id&gt;
          &lt;name&gt;ABCD&lt;/name&gt;
        &lt;/contact&gt;
  
        &lt;contact&gt;
          &lt;id&gt;3&lt;/id&gt;
          &lt;name&gt;ABCDE&lt;/name&gt;
        &lt;/contact&gt;
  
      &lt;/contacts&gt;
    &lt;/Event&gt;
  </code></pre>
  
  <p>To get the XML document I use</p>
  
  <pre><code>XDocument xml = new XDocument();
  xmlDoc = XDocument.Load("Data.xml");
  </code></pre>
  
  <p>I'm struck on how to read the items to a list. How can I do it?</p>