/**
  * Save New Navigation
  *
  */
 public function saveNavigationService(NavigationBuilder_NavigationModel $navigation)
 {
     if ($navigation->id) {
         $navigationRecord = NavigationBuilder_NavigationRecord::model()->findById($navigation->id);
         if (!$navigationRecord) {
             throw new Exception(Craft::t('No navigation exists with the ID “{id}”', array('id' => $navigation->id)));
         }
         $isNewNavigation = false;
     } else {
         $navigationRecord = new NavigationBuilder_NavigationRecord();
         $isNewNavigation = true;
     }
     $navigationRecord->name = $navigation->name;
     $navigationRecord->handle = $navigation->handle;
     $navigationRecord->description = $navigation->description;
     // $navigationRecord->navNode         = JsonHelper::encode($navigation->navNode);
     $navigationRecord->validate();
     $navigation->addErrors($navigationRecord->getErrors());
     if (!$navigation->hasErrors()) {
         $transaction = craft()->db->getCurrentTransaction() === null ? craft()->db->beginTransaction() : null;
         try {
             $navigationRecord->save();
             if (!$navigation->id) {
                 $navigation->id = $navigationRecord->id;
             }
             $this->_navigationsById[$navigation->id] = $navigation;
             if ($transaction !== null) {
                 $transaction->commit();
             }
         } catch (\Exception $e) {
             if ($transaction !== null) {
                 $transaction->rollback();
             }
             throw $e;
         }
         return true;
     } else {
         return false;
     }
 }