title: Query items inside collection inside collection
body: <p>I have the following classes in my .net core 2.0-mvc app:</p>
  
  <pre><code>public class TeamMatch
  {
      public int ID { get; set; }
      public virtual ICollection&lt;IndividualMatch&gt; Matches { get; set; }
  
      public IEnumerable&lt;Map&gt; GetMaps()
      {
          var list = new List&lt;IndividualMatch&gt;();
          list.AddRange(Matches.GroupBy(m =&gt; m.MatchMap.ID).Select(u =&gt; u.First()));
          return list.Select(m =&gt; m.MatchMap);
      }
  }
  
  public class IndividualMatch
  {
      public int ID { get; set; }
      public Map MatchMap { get; set; }
  }
  public class Map
  {
      public int ID { get; set; }
      public string Name { get; set; }
  }
  </code></pre>
  
  <p>And this gets passed from the Controller to the View:</p>
  
  <pre><code>public IActionResult Index()
  {
      var dat = _context.TeamMatches.Include(tm =&gt; tm.Matches).ToList();
      return View(dat);
  }
  </code></pre>
  
  <p>I get a NullReferenceException when calling TeamMatch.GetMaps() in that View. Specifically in this line, it is supposed to give me an array of unique Maps in all of the IndividualMatches:</p>
  
  <pre><code>list.AddRange(Matches.GroupBy(p =&gt; p.MatchMap.ID).Select(g =&gt; g.First()));
  </code></pre>
  
  <p>I assume I somehow need to get "1 level deeper" than just the IndividualMatch that I've included there. How do I accomplish this?</p>