registration logic moved from controller to userFactory