title: Remove() doesn't work with many-to-many relationship in Entity Framework
body: <p>I am trying to remove an object from a collection in entity framework, but unfortunately my code is failing. I would be grateful if you could have a look and let me know if you can figure out what I'm doing wrong. My objects are as follows:</p>
  
  <ul>
  <li>Person &lt;-> Badge (many-to-many relationship)</li>
  <li>Badge &lt;-> BadgeRequirement (one-to-many relationship) </li>
  <li>Person contains an <strong>ICollection</strong> of Badges</li>
  <li>Badge contains an <strong>ICollection</strong> of Person </li>
  <li>BadgeRequirement contains a Badge <strong>Foreign Key</strong></li>
  </ul>
  
  <p>Adding and editing entries works absolutely fine.</p>
  
  <p>However, when I try to remove a Badge from a Person using the code below, it doesn't work:</p>
  
  <pre><code>Postback event handler on example.aspx
  ****The person object has been loaded as part of the load event on the page****
  
  Badge badge = BadgeHelper.getBadge(badgeID);
  if (command == "Delete")
  {
   PersonHelper.removeBadgeFromPerson(badge, person);
   }
  
   Delete method on PersonHelper class (wrapper for all processing)
  
   person.Badges.Remove(badge);
   DbContext.SaveChanges();
  </code></pre>
  
  <p>The Remove(badge) returns false and I cannot profile this as I am using SQL Compact 4.0</p>
  
  <p>Thanks in advance for your help!</p>