Moved common functions from Teacher, Student, and Admin controllers into UserController helper function