Enhance registration: modified the registeration method to return the user id if it's already registered and refactored the model code