Moved determining which attribute to use for the name of a user to a separate class for testability