refactor extracted the has-many-through code to a seperate method