/**
  * Creates an new object
  *
  * @param \OCA\Calendar\IObject $object
  * @throws \OCA\Calendar\BusinessLayer\Exception
  * @return \OCA\Calendar\IObject
  */
 public function create(IObject $object)
 {
     try {
         if (is_null($object->getUri())) {
             $object->setUri(ObjectUtility::randomURI());
         }
         $object->setCalendar($this->calendar);
         // generate an provisional etag, backends can overwrite it if necessary
         $object->getEtag(true);
         $this->checkCalendarSupports(Permissions::CREATE);
         if (!$this->api instanceof BackendUtils\IObjectAPICreate) {
             throw new Exception('Backend does not support creating objects');
         }
         $this->checkObjectIsValid($object);
         Util::emitHook('\\OCA\\Calendar', 'preCreateObject', array($object));
         $object = $this->api->create($object);
         if ($this->isCachingEnabled) {
             $this->updater->propagate($object->getUri());
         }
         Util::emitHook('\\OCA\\Calendar', 'postCreateObject', array($object));
         return $object;
     } catch (BackendUtils\Exception $ex) {
         throw Exception::fromException($ex);
     }
 }