public function persistToDatabase()
 {
     $this->writeXmlParam('state', json_encode($this->getJson()), true);
     $this->cronk->cronk_xml = $this->dom->saveXML();
     $return = $this->cronk->state() === Doctrine_Record::STATE_CLEAN ? false : true;
     $this->cronk->save();
     return $return;
 }
 /**
  * If we want to work on a system cronk we need a related
  * database record. This is done here ...
  *
  * @param array $cronk
  */
 private function createSystemCronkDatabaseEntry(array $cronk)
 {
     $root = Doctrine::getTable('NsmUser')->findOneBy('user_name', 'root');
     $record = new Cronk();
     $record->cronk_description = 'System cronk credential enty, please ignore!';
     $record->cronk_uid = $cronk['cronkid'];
     $record->cronk_name = $cronk['name'];
     $record->owner = $root;
     $record->cronk_system = true;
     $record->save();
     return $record;
 }