refactoring user creation into user factory