public function login($dbConnection = null)
 {
     global $facebook;
     global $session;
     $facebookID = null;
     $loggedIn = false;
     try {
         $facebookID = $facebook->getUser();
         if ($facebookID != null) {
             if ($dbConnection == null) {
                 $dbConnection = DatabaseUtilities::getDatabaseConnection();
             }
             $sessionKey = SessionDao::generateSGUID($facebookID, $dbConnection);
             //If sguid is null, attempt to create users account.
             if ($sessionKey == null) {
                 //If member account is successfully created, attemp to generate a GUID.
                 if (LoginController::createMemberAccount($facebookID, $facebook)) {
                     //Account should have been created, get SGUID.
                     $sessionKey = SessionDao::generateSGUID($facebookID, $dbConnection);
                 }
             }
             //If session key has been created, add to session
             if ($sessionKey != null) {
                 //Refresh any old sessions.
                 if (SessionDao::updateSession($facebookID, $sessionKey, $dbConnection)) {
                     $_SESSION[LoginController::SESSION_ID] = $sessionKey;
                     $loggedIn = true;
                 }
             }
         } else {
             //User has not authenticated with Facebook.
         }
     } catch (Exception $ex) {
         echo "Exception: " . $ex->getMessage();
         $loggedIn = false;
     }
     return $loggedIn;
 }