added validation logic for saving a new user