public function updateGroupProviderId($oldId, $newId)
 {
     if (strlen($oldId) > 0 && strlen($newId) > 0 && $oldId != $newId) {
         $dao = new EngineBlock_Model_DbTable_GroupProviderPrecondition();
         return $dao->update(array('group_provider_id' => $newId), "group_provider_id = '{$oldId}'");
     } else {
         // ignore
         return true;
     }
 }
 protected function _savePreconditions($row, $preconditions)
 {
     // delete the old
     $gppTable = new EngineBlock_Model_DbTable_GroupProviderPrecondition();
     $gppoTable = new EngineBlock_Model_DbTable_GroupProviderPreconditionOption();
     $gppOld = $gppTable->fetchAll($gppTable->select("id")->where("group_provider_id = '{$row['id']}'"));
     try {
         // delete the old
         foreach ($gppOld as $old) {
             $old->delete();
             // cascade delete for options
         }
         // insert the new
         foreach ($preconditions as $p) {
             // separate options
             $gppoData = $p['options'];
             unset($p['options']);
             // insert precondition row
             $gppRow = $gppTable->createRow();
             $gppRow->setFromArray($p);
             $gppId = $gppRow->save();
             // insert related options
             if (is_array($gppoData)) {
                 foreach ($gppoData as $o) {
                     $gppoRow = $gppoTable->createRow();
                     $gppoRow->setFromArray($o);
                     $gppoRow->group_provider_precondition_id = $gppId;
                     $gppoRow->save();
                 }
             }
         }
     } catch (Exception $ex) {
         // TODO: handle exception
         throw $ex;
     }
 }