Handle entities with duplicate relation type names properly

e.g. Entities with parent and children relationships.