Added functionality to add new user record or update existing user records when user logs in