public function OnPostback()
 {
     # If there's no id, ensure no match object is created. Page will then display a "match not found" message.
     # There's a separate page for adding matches, even for admins.
     if (!$this->editor->GetDataObjectId()) {
         return;
     }
     # Get the submitted match
     $this->match = $this->editor->GetDataObject();
     # Because this is a new request, we need to reverify whether this is the match owner before letting anything happen.
     # Can't trust that info from a postback so MUST go to the database to check it.
     $this->match_manager->ReadByMatchId(array($this->editor->GetDataObjectId()));
     $check_match = $this->match_manager->GetFirst();
     $this->b_user_is_match_owner = ($check_match instanceof Match and AuthenticationManager::GetUser()->GetId() == $check_match->GetAddedBy()->GetId());
     # Don't wan't to edit tournaments on this page, so even as admin make sure we're not trying to save one.
     # Can't change the match type, so find out what that is from the db too.
     $this->b_is_tournament = $check_match->GetMatchType() == MatchType::TOURNAMENT;
     # Check whether cancel was clicked
     if ($this->editor->CancelClicked()) {
         # Match may have been updated so send an email
         $this->match_manager->NotifyMatchModerator($this->match->GetId());
         # If so, get the match's short URL and redirect
         $this->match_manager->ExpandMatchUrl($this->match);
         $this->Redirect($this->match->GetNavigateUrl());
     }
     # save data if valid
     if ($this->IsValid() and !$this->b_is_tournament) {
         switch ($this->editor->GetCurrentPage()) {
             case ScorecardEditControl::FIRST_INNINGS:
                 $this->match_manager->SaveScorecard($this->match, true, $this->SearchIndexer());
                 $this->editor->SetCurrentPage(ScorecardEditControl::SECOND_INNINGS);
                 break;
             case ScorecardEditControl::SECOND_INNINGS:
                 $this->match_manager->SaveScorecard($this->match, false, $this->SearchIndexer());
                 $this->match_manager->ExpandMatchUrl($this->match);
                 http_response_code(303);
                 $this->Redirect($this->match->EditHighlightsUrl());
                 break;
         }
     }
 }