Added business logic for login and checking if profile exists. references #2