refactoring to move validation method into User model