I am trying to do a combined add/update function on a many-to-many relationship. DB first. Have three sql tables: Personnel, Orders, PersonnelOrders. Here is my code:\[code\]context.ContextOptions.LazyLoadingEnabled = true;if (saveData.Rows.Count() > 1) { foreach (var row in saveData.Rows) { if (row != null) { var Order_Array = row.Order_Array; //Array of order id's to be used below. var pData = http://stackoverflow.com/questions/13830319/new Personnel; { Personnel_Id = row.Key, Personnel_Name = row.Name }; if (pData.Personnel_Id == 0) { context.Personnel.AddObject(cvData); } else { context.Personnel.Attach(cvData); context.ObjectStateManager.ChangeObjectState(pData, EntityState.Modified); } context.SaveChanges(); //works fine to this point. //Now I want to insert records into my join table with values from a passed in array. //This does not work at all the way I have it. context.Personnel.Include("Orders"); pData.Orders.Clear(); //clear all existing relationships if any exist foreach (int Id in Order_Array) pData.Orders.Attach(new Order() { Order_Id = Id }); context.SaveChanges(); } } } return "ok";\[/code\]I get this error message: "The object being attached to the source object is not attached to the same ObjectContext as the source object."