Refacto store function for manyToMany entities