/**
  * Hook performing actual save
  *
  * @param string $newCode
  * @param int $userId
  * @return $changed
  */
 public function setReceptionCode($newCode, $userId)
 {
     $oldCode = $this->respondentTrack->getReceptionCode()->getCode();
     // Use the repesondent track function as that cascades the consent code
     $changed = $this->respondentTrack->setReceptionCode($newCode, $this->formData['gr2t_comment'], $userId);
     if ($this->unDelete) {
         $this->addMessage($this->_('Track restored.'));
         if (isset($this->formData['restore_tokens']) && $this->formData['restore_tokens']) {
             $count = 0;
             foreach ($this->respondentTrack->getTokens() as $token) {
                 if ($token instanceof \Gems_Tracker_Token) {
                     if ($oldCode === $token->getReceptionCode()->getCode()) {
                         $count += $token->setReceptionCode($newCode, null, $userId);
                     }
                 }
             }
             $this->addMessage(sprintf($this->plural('%d token reception codes restored.', '%d tokens reception codes restored.', $count), $count));
         }
     } else {
         if ($this->util->getReceptionCode($newCode)->isStopCode()) {
             $this->addMessage($this->_('Track stopped.'));
         } else {
             $this->addMessage($this->_('Track deleted.'));
         }
     }
     return $changed;
 }