title: General best practice for updating a record and its associated relationships in Linq-to-SQL
body: <p>I have a very general question about updating a record in Linq-to-SQL.  Suppose, in my data model, I have a base record (Table - Person) with an m:m relationship to a set of Categories (Table - Category).  Therefore, I have an associative table (PersonCategory) that has foreign keys to both a PersonID and CategoryID.</p>
  
  <p>When I want to update a Person, I may have new PersonCategory records to add and may want to remove other PersonCategory records.  What is the best practice for doing such a thing?  Would I want to remove all records in Person.RelatedPersonCategories and then add new in?  Is LINQ-to-SQL smart enough to negotiate what records in the PersonCategory table are actually being added, edited, or deleted (based on looking at its foreign key potentially)?</p>
  
  <p>Thanks for any help!</p>