title: How are you supposed to handle the changes to a dynamic list in the controller?
body: <p>So lets say I have a view that delivers the list property <code>UserContext.ServicesList</code> to the controller. The user probably already has an existing list, and we would like to update the changed records to that list. What is the best approach to:</p>
  
  <p>1) Delete records that were removed from the list?</p>
  
  <p>2) Update existing records?</p>
  
  <p>3) Add new records?</p>
  
  <p>Thanks!</p>
  
  <p><strong>Example classes</strong>:</p>
  
  <pre><code>public class UserPage
  {
      [Key]
      public string Id { get; set; }
  
      [ForeignKey("Id")]
      public ApplicationUser User { get; set; }
  
      [DataType(DataType.MultilineText)]
      public string AboutMe { get; set; }
  
      [DataType(DataType.MultilineText)]
      public string AvailableTime { get; set; }
  
      public List&lt;Services&gt; ServicesList { get; set; }
  
  }
  
  public class Services
  {
      [Key]
      public int ServiceId { get; set; }
  
      public string Id { get; set; }
  
      [ForeignKey("Id")]
      public ApplicationUser User { get; set; }
  
      public string ServiceName { get; set; }
  }
  </code></pre>
  
  <p><strong>Example controller</strong>:</p>
  
  <pre><code>[HttpPost]
  public ActionResult Edit(UserPage UserContext)
  {
      if (ModelState.IsValid)
      {
          if (UserContext.ServicesList != null)
          {
              foreach (var item in UserContext.ServicesList)
              {
                  // What do I do here?
              }
          }
          db.Entry(UserContext).State = EntityState.Modified;
          db.SaveChanges();   
          return RedirectToAction("Index");
      }
      return View(UserContext);
  }
  </code></pre>