/**
  * Handles the registration. Validates and creates the member, then redirects
  * to the appropriate place
  *  
  * @param  array $data
  * @param  BootstrapForm $form
  * @return SSViewer
  */
 public function doRegister($data, $form)
 {
     try {
         $back_url = Session::get('BackURL');
         Session::set("FormInfo.{$form->getName()}.data", $data);
         $data = SQLDataCleaner::clean($data);
         $profile_page = EditProfilePage::get()->first();
         $speaker_registration_token = Session::get(SpeakerRegistrationRequest::ConfirmationTokenParamName);
         if (!empty($speaker_registration_token)) {
             $data[SpeakerRegistrationRequest::ConfirmationTokenParamName] = $speaker_registration_token;
         }
         $member = $this->member_manager->registerSpeaker($data, new MemberRegistrationSenderService());
         //Get profile page
         if (!is_null($profile_page)) {
             //Redirect to profile page with success message
             Session::clear("FormInfo.{$form->FormName()}.data");
             if ($back_url) {
                 $redirect = HTTP::setGetVar('welcome', 1, $back_url);
                 return OpenStackIdCommon::loginMember($member, $redirect);
             }
             $form->sessionMessage('Awesome! You should receive an email shortly.', 'good');
             Session::clear(SpeakerRegistrationRequest::ConfirmationTokenParamName);
             Session::clear('BackURL');
             return OpenStackIdCommon::loginMember($member, $this->redirectBackUrl());
         }
     } catch (EntityValidationException $ex1) {
         Form::messageForForm($form->FormName(), $ex1->getMessage(), 'bad');
         //Return back to form
         SS_Log::log($ex1->getMessage(), SS_Log::WARN);
         return $this->redirectBack();
     } catch (Exception $ex) {
         Form::messageForForm($form->FormName(), "There was an error with your request, please contact your admin.", 'bad');
         //Return back to form
         SS_Log::log($ex->getMessage(), SS_Log::ERR);
         return $this->redirectBack();
     }
 }