title: Entity Framework 4 - How to Update an Object
body: <p>net 4 and c#.</p>
  
  <p>I have an Object (myContentObj) and a navigational property (CmsGroupsTypes).</p>
  
  <p><strong>I need update the navigational property for specific objct.</strong></p>
  
  <p>At the moment I use this code below to remove the current association and add a new one, so I can Update the navigational property. </p>
  
  <p>Albeit my code works, I would like to know if you know a better approach to it... I am not sure if exist an UPDATE method or similar in EF4.</p>
  
  <p>Thanks for your help!</p>
  
  <pre><code>            // Remove object
              myContentObj.CmsGroupsTypes.Remove(myCurrentGroupTypeObj);
              // Update object
              myContentObj.CmsGroupsTypes.Add(myNewGroupTypeObj);
              context.SaveChanges();
  </code></pre>