public function writeToPersistence()
 {
     if (empty($this->uuid)) {
         $this->uuid = io::uuid();
     }
     $fields = array('objectdefinition', 'codename', 'html', 'label', 'parameter', 'uuid');
     $sql_fields = '';
     foreach ($fields as $field) {
         $sql_fields .= empty($sql_fields) ? '' : ', ';
         $sql_fields .= $field . '_mood="' . CMS_query::echap($this->{$field}) . '"';
     }
     if ($this->id) {
         $sql = 'UPDATE mod_object_oembed_definition SET ' . $sql_fields . ' WHERE id_mood = ' . $this->id;
     } else {
         $sql = 'INSERT INTO mod_object_oembed_definition SET ' . $sql_fields;
     }
     $q = new CMS_query($sql);
     if ($q->hasError()) {
         $this->raiseError("Can't save object");
         return false;
     } elseif (!$this->id) {
         $this->id = $q->getLastInsertedID();
     }
 }