Refactor get_parent_locations and users
STUD-1663