title: Entity Framework / MVC: Writing a collection to the database
body: <p>What I have looks something like this:</p>
  
  <pre><code>class foo
  {
    [Key]
    int ID;
    List&lt;Bar&gt; bars;
    string s;
  }
  class bar
  {
    [Key]
    int ID;
    string s;
  }
  </code></pre>
  
  <p>then in the controller:</p>
  
  <pre><code>public ActionResult BeAwesome(foo doo)
  {
    db.Entry(doo).State = EntityState.Modified;
    db.SaveChanges();
    return View(doo);
  }
  </code></pre>
  
  <p>I can confirm that doo is being passed in with a list of bars, but the bars are not being propagated to the database.  doo.s does get saved.  What do I need to do to get the collection to save?</p>