improve syntax of before save in User model