public function addEvent(Event $event, EntityInterface $entity, ArrayObject $options = null): void
    {
        $entities = $result = [];

        if (empty($options)) {
            $options = new ArrayObject();
        }

        /** @var \Cake\ORM\Table $table */
        $table = $event->getSubject();

        /** @var \Qobo\Calendar\Model\Table\CalendarsTable $calendarsTable */
        $calendarsTable = TableRegistry::get('Qobo/Calendar.Calendars');
        /** @var \Qobo\Calendar\Model\Table\CalendarEventsTable $eventsTable */
        $eventsTable = TableRegistry::get('Qobo/Calendar.CalendarEvents');
        $calendars = $calendarsTable->getByAllowedEventTypes($table->alias());

        $options['entity'] = $entity;
        $options['viewEntity'] = new View();

        $entities = $eventsTable->getEventsFromEntities($table, $calendars, $options);

        if (!empty($entities)) {
            foreach ($entities as $item) {
                $saved = $eventsTable->saveEvent($item);
                $result[] = $saved;
            }
        }

        $event->result = $result;
    }