/**
  * If the user is not logged in, then redirect them to the given path.
  *
  * @param $redirect the path to redirect the user to if they are not logged in
  */
 protected function _requireLoggedIn($redirect = null)
 {
     try {
         parent::_requireUserLoggedIn();
     } catch (NotLoggedInException $e) {
         if (isset($redirect)) {
             header('location: ' . $redirect);
             exit;
         }
         throw $e;
     }
 }