title: Edit Action not writing referenced ApplicationUser Id to DB in MVC code first
body: <p>I have referenced the ASP.NET Identity ApplicationUser model in all of my tables (LastUpdatedByUser)</p>
  
  <p>When I try to set it as the current user in the Edit method the object property is set correctly but the SQL generated does not include the LastUpdateByUser_Id in the UPDATE query.</p>
  
  <p>Model property:</p>
  
  <pre><code>public class ConsignmentStatus
  {
  //...
  
  [Required]
  [Display(Name = "UpdatedBy", ResourceType = typeof(Resources.Resources))]
  public ApplicationUser LastUpdatedByUser { get; set; }
  }
  </code></pre>
  
  <p>Edit action on controller:</p>
  
  <pre><code> [HttpPost]
      [ValidateAntiForgeryToken]
      public async Task&lt;ActionResult&gt; Edit([Bind(Include = "ID,Code,Name,Description,IsTruckInbound,IsRailInbound,IsVesselOutbound,IsCarImport,IsBulkImport,IsTruckOutbound,NameLocal,LastUpdatedByUser")] ConsignmentStatus consignmentStatus)
      {
          var userManager = new ApplicationUserManager(new UserStore&lt;ApplicationUser&gt;(db));
          var _user = (from u in db.Users
                       where u.UserName == User.Identity.Name
                       select u).First();
  
          consignmentStatus.LastUpdatedByUser = _user;
  
          ModelState.Clear();
          TryValidateModel(consignmentStatus);
  
          if (ModelState.IsValid)
              {
                  db.Entry(consignmentStatus).State = EntityState.Modified;
                  await db.SaveChangesAsync();
                  return RedirectToAction("Index");
              }
           return View(consignmentStatus);
      }
  </code></pre>
  
  <p>What am I missing? I've tried everything!</p>
  
  <p>Here's the query it generates. Note the missing LastUpdatedByUser_Id:</p>
  
  <pre><code>UPDATE [dbo].[ConsignmentStatus]
  SET [Code] = @0, [Name] = @1, [NameLocal] = @2, [Description] = NULL, 
  [IsTruckInbound] = @3, [IsRailInbound] = @4, [IsVesselOutbound] = @5, 
  [IsCarImport] = @6, [IsBulkImport] = @7, [IsTruckOutbound] = @8, 
  [LastUpdatedDateTime] = @9, [Deleted] = @10
  WHERE ([ID] = @11)
  
  -- @0: 'WA' (Type = String, Size = -1)
  -- @1: 'Wagons Arrived' (Type = String, Size = -1)
  -- @2: '1232412312' (Type = String, Size = -1)
  -- @3: 'False' (Type = Boolean)
  -- @4: 'True' (Type = Boolean)
  -- @5: 'False' (Type = Boolean)
  -- @6: 'False' (Type = Boolean)
  -- @7: 'False' (Type = Boolean)
  -- @8: 'False' (Type = Boolean)
  -- @9: '10/01/2019 12:29:32' (Type = DateTime2)
  -- @10: 'False' (Type = Boolean)
  -- @11: '24' (Type = Int32)
  </code></pre>