title: List orderby nested property
body: <p>I have some data coming back from a web service, which I have mapped to the following classes:</p>
  
  <pre><code>public class Webinar {
      public string Title { get; set; }
      public string Description { get; set; }
      ...
      public List&lt;TimeZone&gt; TimeZones { get; set; }
  }
  
  public class TimeZone {
      public TimeSpan GmtOffset { get; set; }
      public List&lt;Session&gt; Session { get; set; }
  }
  
  public class Session {
      public int WebinarKey { get; set; }
      public DateTime StartTime { get; set; }
      public TimeSpan Duration { get; set; }
  }
  </code></pre>
  
  <p>Hopefully it's fairly clear what is going on: any one webinar can have multiple time zones which in turn holds the individual sessions.</p>
  
  <p>I have a list of webinars <code>List&lt;Webinar&gt; webinars = ...</code> which is populated with data. On the page I would like to present webinars grouped by time zone (easy) and then sorted by their start time.</p>
  
  <p>My problem: the sessions are not necessarily ordered by StartTime when I receive the data, which I would like to do. I have the following code which does work, but recreating each object and mapping out all it's properties is a PITA, is there a nicer way to do what I want?</p>
  
  <pre><code>List&lt;Webinar&gt; webinarsWithOrderedSessions = new List&lt;Webinar&gt;();
  
  foreach (Webinar webinar in mappedWebinars)
  {
      Webinar currentWebinar = new Webinar
          {
              Title = webinar.Title,
              ...
              TimeZones = new List&lt;TimeZone&gt;()
          };
  
      foreach (Webinar.TimeZone timeZone in webinar.TimeZones)
      {
          Webinar.TimeZone currentTimeZone = new TimeZone
              {
                  Location = timeZone.Location,
                  Sessions = new List&lt;Session&gt;()
              };
  
          currentTimeZone.Sessions = timeZone.Sessions.OrderBy(session =&gt; session.StartTime).ToList();
          currentWebinar.TimeZones.Add(currentTimeZone);
      }
  
      webinarsWithOrderedSessions.Add(currentWebinar);
  }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Building upon the suggestion by @Max, why might this bit of code not work? It doesn't seem to add the sessions at all. I don't necessarily need two properties, so I thought I'd just apply your suggestion directly to the main property.</p>
  
  <pre><code>public class TimeZone
  {
      private List&lt;Session&gt; _sessions;
  
      public List&lt;Session&gt; Sessions
      {
          get { return _sessions.OrderBy(s =&gt; s.StartTime).ToList(); }
          set { _sessions = value; }
      }
  }
  </code></pre>