/**
  * Hook performing actual save
  *
  * @param string $newCode
  * @param int $userId
  * @return $changed
  */
 public function setReceptionCode($newCode, $userId)
 {
     // Get the code object
     $code = $this->util->getReceptionCode($newCode);
     // Use the token function as that cascades the consent code
     $changed = $this->token->setReceptionCode($code, $this->formData['gto_comment'], $userId);
     if ($code->isSuccess()) {
         $this->addMessage(sprintf($this->_('Token %s restored.'), $this->token->getTokenId()));
     } else {
         $this->addMessage(sprintf($this->_('Token %s deleted.'), $this->token->getTokenId()));
         if ($code->hasRedoCode()) {
             $newComment = sprintf($this->_('Redo of token %s.'), $this->token->getTokenId());
             if ($this->formData['gto_comment']) {
                 $newComment .= "\n\n";
                 $newComment .= $this->_('Old comment:');
                 $newComment .= "\n";
                 $newComment .= $this->formData['gto_comment'];
             }
             $this->_replacementTokenId = $this->token->createReplacement($newComment, $userId);
             // Create a link for the old token
             $oldToken = strtoupper($this->token->getTokenId());
             $menuItem = $this->menu->findAllowedController('track', 'show');
             if ($menuItem) {
                 $paramSource['gto_id_token'] = $this->token->getTokenId();
                 $paramSource[\Gems_Model::ID_TYPE] = 'token';
                 $href = $menuItem->toHRefAttribute($paramSource);
                 if ($href) {
                     // \MUtil_Echo::track($oldToken);
                     $link = \MUtil_Html::create('a', $href, $oldToken);
                     $oldToken = $link->setView($this->view);
                 }
             }
             // Tell what the user what happened
             $this->addMessage(new \MUtil_Html_Raw(sprintf($this->_('Created this token %s as replacement for token %s.'), strtoupper($this->_replacementTokenId), $oldToken)));
             // Lookup token
             $newToken = $this->loader->getTracker()->getToken($this->_replacementTokenId);
             // Make sure the Next token is set right
             $this->token->setNextToken($newToken);
             // Copy answers when requested.
             if ($code->hasRedoCopyCode()) {
                 $newToken->setRawAnswers($this->token->getRawAnswers());
             }
         }
     }
     $respTrack = $this->token->getRespondentTrack();
     if ($nextToken = $this->token->getNextToken()) {
         if ($recalc = $respTrack->checkTrackTokens($userId, $nextToken)) {
             $this->addMessage(sprintf($this->plural('%d token changed by recalculation.', '%d tokens changed by recalculation.', $recalc), $recalc));
         }
     }
     return $changed;
 }