public function save($object)
 {
     $model = ARResource::model();
     $transaction = $model->getDbConnection()->beginTransaction();
     try {
         if (isset($object->id) && $object->id !== 0) {
             $resource = $model->findByPk($object->id);
         }
         if (!isset($resource) || is_null($resource)) {
             $resource = $model->find('name = :name', array('name' => $object->name));
             if (isset($resource) && !is_null($resource)) {
                 throw new Exception('Resource with name already exists');
             }
             $resource = new ARResource();
             $resource->create_date = time();
         }
         $class = ResourceType::model()->find('name=:name', array('name' => $object->type));
         if (!$class) {
             throw new Exception('Invalid CLASS');
         }
         $resource->type_id = $class->id;
         $resource->name = $object->name;
         $resource->update_date = time();
         if (!$resource->save()) {
             throw new Exception('Could not save RESOURCE_TYPE');
         }
         $this->synchronizeProperties($resource, $object->property);
         $this->synchronizeOjbects($resource, $object->objects);
         $transaction->commit();
     } catch (Exception $e) {
         $transaction->rollback();
         throw $e;
     }
     return true;
 }