Fix updating many-to-many relations. Also don't try to delete related objects when there is none.