public function getEventsFromEntities(Table $table, array $calendars, ArrayObject $options): array
    {
        $entities = [];

        if (empty($calendars)) {
            return $entities;
        }

        $map = ObjectFactory::getConfig($table->alias(), 'Event', $options['event_type']);
        foreach ($calendars as $calendar) {
            $options = array_merge($options->getArrayCopy(), ['calendar' => $calendar]);
            $options = new ArrayObject($options);
            $entity = $options['entity'];

            // The following is a temporary solution until the ObjectTrait is being used
            if (!method_exists($table, 'getObjectInstance')) {
                continue;
            }

            $eventObject = $table->getObjectInstance($entity, $map, $options);
            $calendarEntity = $eventObject->toEntity();

            if (!$calendarEntity) {
                continue;
            }

            $entities[] = $calendarEntity;
        }

        return $entities;
    }