moving the relation handling into a seperate method