Problem with many-to-many dependencies