[entity] put 'join persons' code in a separate class