Added test for many-to-many relationship

Added test so that the related object of a many-to-many relationship gets also updated when being added.