/**
  * Hook containing the actual save code.
  *
  * Call's afterSave() for user interaction.
  *
  * @see afterSave()
  */
 protected function saveData()
 {
     // feature request #200
     if (isset($this->formData['gtr_organizations']) && is_array($this->formData['gtr_organizations'])) {
         $this->formData['gtr_organizations'] = '|' . implode('|', $this->formData['gtr_organizations']) . '|';
     }
     if ($this->trackEngine) {
         $this->formData['gtr_survey_rounds'] = $this->trackEngine->calculateRoundCount();
     } else {
         $this->formData['gtr_survey_rounds'] = 0;
     }
     parent::saveData();
     // Check for creation
     if ($this->createData) {
         if (isset($this->formData['gtr_id_track'])) {
             $this->trackId = $this->formData['gtr_id_track'];
         }
     } elseif ($this->trackEngine && isset($this->formData[$this->_oldClassName], $this->formData['gtr_track_class']) && $this->formData[$this->_oldClassName] != $this->formData['gtr_track_class']) {
         // Track conversion
         $this->trackEngine->convertTo($this->formData['gtr_track_class']);
     }
 }