title: Nested list is cleared out with second call to context class
body: <p>Hey I have structure which looks like this:
  <a href="https://i.stack.imgur.com/HeQSc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HeQSc.png" alt="enter image description here"></a></p>
  
  <p>Those are 2 libraries which have some data inside and also list of books called "books".</p>
  
  <p>Inside of my Library controller I'm filling context with mocked data like: </p>
  
  <pre><code>public LibrariesController(LibrariesContext context)
      {
          _context = context;
  
          if (_context.Libraries.Count() == 0)
          {
              // Create a new TodoItem if collection is empty,
              // which means you can't delete all TodoItems.
              _context.AddRange(getMockedLibraries());
  
              _context.SaveChanges();
          }
      }
  </code></pre>
  
  <p>Methods for mocking data just add some static content to this context like:</p>
  
  <pre><code>private List&lt;Book&gt; getMockedBooks()
      {
          List&lt;Book&gt; mockedBooks = new List&lt;Book&gt;();
  
          Book newBook = new Book();
          newBook.Title = "Pride and Prejudice (Paperback)";
          newBook.Author = "Jane Austen";
  
          mockedBooks.Add(newBook);
  
          newBook = new Book();
          newBook.Title = "To Kill a Mockingbird (Paperback)";
          newBook.Author = "Harper Lee";
  
          mockedBooks.Add(newBook);
  
          return mockedBooks;
      }
  
      private List&lt;Library&gt; getMockedLibraries()
      {
  
          List&lt;Library&gt; mockedLibraries = new List&lt;Library&gt;();
  
  
  
          Library newLibrary = new Library();
  
          newLibrary.Name = "ZUT Library";
          newLibrary.ImgSrc = "http://przemysl-40.pl/wp-content/uploads/logo_ZUT.jpg";
          newLibrary.Books = getMockedBooks();
  
          mockedLibraries.Add(newLibrary);
  
          newLibrary = new Library();
  
          newLibrary.Name = "US Library";
          newLibrary.ImgSrc = "http://partner.kubg.edu.ua/images/stories/Partners/poland1.jpg";
          newLibrary.Books = getMockedBooks();
  
          mockedLibraries.Add(newLibrary);
  
          return mockedLibraries;
  
      }
  </code></pre>
  
  <p>My LibrariesContext is based on DBContextOptions and has Libraries DbSet inside:</p>
  
  <pre><code>public class LibrariesContext : DbContext
  {
      public LibrariesContext(DbContextOptions&lt;LibrariesContext&gt; options)
          : base(options)
      {
      }
  
      public DbSet&lt;Library&gt; Libraries { get; set; }
      public DbSet&lt;Book&gt; Books { get; set; }
  }
  </code></pre>
  
  <p>The funniest part happen when I go to the /api/Libraries endpoint and want to see bueatifull JSON on my site second time, implementation looks like: </p>
  
  <pre><code>// GET: api/Libraries
      [HttpGet]
      public async Task&lt;ActionResult&lt;IEnumerable&lt;Library&gt;&gt;&gt; GetTodoItems()
      {
          return await _context.Libraries.ToListAsync();
      }
  </code></pre>
  
  <p>I'm a beginner with a .NetCore and I can't understand why after second request to the same endpoint I got some nulls in place of books list like:</p>
  
  <p><a href="https://i.stack.imgur.com/tXaXd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tXaXd.png" alt="enter image description here"></a></p>
  
  <p>I would be really grateful for any advice.</p>