database model refactored many to many