refactor getRelationship