title: Linq to Sql Many to Many relationships
body: <p>I have just started a new project using a Linq to Sql model and I'm implementing our first many to many relationship.  I have found this blog that gives great info on how implement this:</p>
  
  <p><a href="http://blogs.msdn.com/mitsu/archive/2008/03/19/how-to-implement-a-many-to-many-relationship-using-linq-to-sql-part-ii-add-remove-support.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/mitsu/archive/2008/03/19/how-to-implement-a-many-to-many-relationship-using-linq-to-sql-part-ii-add-remove-support.aspx</a></p>
  
  <p>When I try to add some child objects in and then remove one before saving I get an error,</p>
  
  <blockquote>
    <p>System.InvalidOperationException:
    Cannot remove an entity that has not
    been attached.</p>
  </blockquote>
  
  <p>Any ideas?  Someone has already commented on this to the author of the blog, but there has been no response.</p>
  
  <p>Much appreciated!</p>