Fixed a bug with many-to-many mapping (attaching)