/**
  * Register action
  * @param type $data
  * @param type $form
  * @return \SS_HTTPResponse
  */
 public function doRegister($data, $form)
 {
     $att = Attendance::get()->filter(array('MemberID' => $data['MemberID'], 'MatchID' => $data['MatchID']));
     if ($att->exists()) {
         $r = $att->sort('LastEdited', 'DESC')->First();
     } else {
         $r = new Attendance();
     }
     $form->saveInto($r);
     $r->write();
     // $from = Email::getAdminEmail();
     // $to = $r->Email;
     // $bcc = $EventDetails->RSVPEmail;
     // $subject = "Event Registration - ".$EventDetails->Title." - ".date("d/m/Y H:ia");
     // $body = "";
     // $email = new Email($from, $to, $subject, $body, null, null, $bcc);
     // $email->setTemplate('EventRegistration');
     // $email->send();
     return Controller::curr()->redirectBack();
 }