title: MVC3 using CheckBox with a complex viewmodel
body: <p>Right guys. I need your brains as I can't find a way to do this properly.</p>
  
  <p>I have a view model:</p>
  
  <pre><code>public class EditUserViewModel
  {
      public User User;
      public IQueryable&lt;ServiceLicense&gt; ServiceLicenses;
  }
  </code></pre>
  
  <p>User is unimportant as I know how to deal with it.</p>
  
  <p>ServiceLicenses has the following implementation:</p>
  
  <pre><code>public class ServiceLicense
  {
      public Guid ServiceId { get; set; }
      public string ServiceName { get; set; }
      public bool GotLic { get; set; }
  }
  </code></pre>
  
  <p>Getting a checked list of users is cool. It works like a charm.</p>
  
  <pre><code>&lt;fieldset&gt;
      &lt;legend&gt;Licenses&lt;/legend&gt;
      @foreach (var service in Model.ServiceLicenses)
      {     
      &lt;p&gt;
          @Html.CheckBoxFor(x =&gt; service.GotLic)
          @service.ServiceName
      &lt;/p&gt;
      } 
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>The problem I'm having is getting the updated ServiceLicenses object with new checked services back to the HttpPost in my controller. For simplicity lets say it looks like this:</p>
  
  <pre><code>    [HttpPost]
      public ActionResult EditUser(Guid id, FormCollection collection)
      {
  
          var userModel = new EditUserViewModel(id);
          if (TryUpdateModel(userModel))
          {
              //This is fine and I know what to do with this
              var editUser = userModel.User;
  
              //This does not update
              var serviceLicenses = userModel.ServiceLicenses;
  
              return RedirectToAction("Details", new { id = editUser.ClientId });
          }
          else
          {
              return View(userModel);
          }
      }
  </code></pre>
  
  <p>I know I am using CheckBox the wrong way. What do I need to change to get serviceLicenses to update with the boxes checked in the form?</p>