created a function within UserController file