public function getEvents(?EntityInterface $calendar, array $options = [], bool $isInfinite = true): array
    {
        $result = [];

        if (!$calendar) {
            return $result;
        }

        $events = $this->findCalendarEvents($options);

        /** @var \Cake\Datasource\EntityInterface $event */
        foreach ($events as $event) {
            $eventItem = $this->prepareEventData($event->toArray(), $calendar);

            if (empty($eventItem['recurrence'])) {
                array_push($result, $eventItem);
                continue;
            }

            $recurrence = $this->getRRuleConfiguration($eventItem['recurrence']);

            if (empty($recurrence)) {
                continue;
            }

            $intervals = $this->getRecurrence($recurrence, [
                'start' => $eventItem['start_date'],
                'end' => $eventItem['end_date'],
            ]);

            foreach ($intervals as $interval) {
                $entity = $this->prepareRecurringEventData($eventItem, $interval, $calendar);
                if (empty($entity)) {
                    continue;
                }

                array_push($result, $entity->toArray());
            }
        }

        $infiniteEvents = $this->getInfiniteEvents($events, $options, $isInfinite);

        foreach ($infiniteEvents as $event) {
            $eventItem = $this->prepareEventData($event->toArray(), $calendar);

            $recurrence = $this->getRRuleConfiguration($eventItem['recurrence']);

            if (empty($recurrence)) {
                continue;
            }

            $intervals = $this->getRecurrence($recurrence, [
                'start' => $eventItem['start_date'],
                'end' => $options['period']['end_date'],
                'from' => $options['period']['start_date'],
                'fixTime' => true,
            ]);

            foreach ($intervals as $interval) {
                $entity = $this->prepareRecurringEventData($eventItem, $interval, $calendar);
                if (empty($entity)) {
                    continue;
                }

                array_push($result, $entity->toArray());
            }
        }

        return $result;
    }