An object with the same key already exists in the ObjectStateManager. The ObjectStateManager cannot track multiple objects with the same key
Edit: Original answer used Find instead of Local.SingleOrDefault. It worked in combination with @Juan’s Save method but it could cause unnecessary queries to database and else part was probably never executed (executing the else part would cause exception because Find already queried the database and hadn’t found the entity so it could not be updated). … Read more