public function save($data, $overwrite = false)
 {
     if (isset($data['group_provider_id']) && isset($data['precondition_id']) && $data['precondition_id'] == $data['org_precondition_id'] && !$overwrite) {
         $group_provider_id = htmlentities($data['group_provider_id']);
         $precondition_id = htmlentities($data['precondition_id']);
         $preconditionService = new EngineBlock_Service_GroupProviderPrecondition();
         $precondition = $preconditionService->fetchById($group_provider_id, $precondition_id);
     } else {
         $precondition = new EngineBlock_Model_GroupProviderPrecondition();
     }
     $precondition->populate($data);
     $form = new EngineBlock_Form_GroupProviderPrecondition();
     if (!$form->isValid($precondition->toArray())) {
         $formErrors = $form->getErrors();
         $modelErrors = array();
         foreach ($formErrors as $fieldName => $fieldErrors) {
             foreach ($fieldErrors as $fieldError) {
                 switch ($fieldError) {
                     case 'isEmpty':
                         $error = 'Field is obligatory, but no input given';
                         break;
                     default:
                         $error = $fieldError;
                 }
                 if (!isset($modelErrors[$fieldName])) {
                     $modelErrors[$fieldName] = array();
                 }
                 $modelErrors[$fieldName][] = $error;
             }
         }
         $precondition->errors = $modelErrors;
     } else {
         $mapper = new EngineBlock_Model_Mapper_GroupProviderPrecondition(new EngineBlock_Model_DbTable_GroupProviderPrecondition());
         $isNewRecord = isset($data['org_precondition_id']) && $precondition->precondition_id != $data['org_precondition_id'];
         $mapper->save($precondition, $isNewRecord);
     }
     return $precondition;
 }
 public function preconditiondeleteAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $service = new EngineBlock_Service_GroupProviderPrecondition();
     return $service->delete(htmlentities($this->_getParam('group_provider_id')), htmlentities($this->_getParam('precondition_id')));
 }