/**
  * Find all objects in a certain time-frame in a calendar
  *
  * @param \DateTime $start start of time-frame
  * @param \DateTime $end end of time-frame
  * @param integer $type
  * @param integer $limit
  * @param integer $offset
  * @throws \OCA\Calendar\BusinessLayer\Exception
  * @return \OCA\Calendar\IObjectCollection
  */
 public function findAllInPeriod(DateTime $start, DateTime $end, $type = ObjectType::ALL, $limit = null, $offset = null)
 {
     if ($this->isCachingEnabled) {
         if ($this->calendar->checkUpdate()) {
             $this->calendar->propagate();
         }
         return $this->cache->findAllInPeriod($start, $end, $type, $limit, $offset);
     } else {
         if ($this->api instanceof BackendUtils\IObjectAPIFindInPeriod) {
             return $this->api->findAllInPeriod($start, $end, $type, $limit, $offset);
         } else {
             $objects = $this->api->findAll($type);
             $objects->inPeriod($start, $end);
             $objects->subset($limit, $offset);
             return $objects;
         }
     }
 }