protected function getRelatedFieldValue(string $field, string $value): array
    {
        $table = TableRegistry::get($this->searchFields[$field]['source']);

        // avoid infinite recursion
        if ($this->table->getAlias() === $table->getAlias()) {
            return [];
        }

        $search = new Search($table, $this->user);
        $basicSearch = new BasicSearch($table, $this->user);

        $criteria = $basicSearch->getCriteria($value);
        if (empty($criteria)) {
            return [];
        }

        $data = [
            'aggregator' => 'OR',
            'criteria' => $criteria
        ];

        $resultSet = $search->execute($data)->all();
        if ($resultSet->isEmpty()) {
            return [];
        }

        $result = [];
        foreach ($resultSet as $entity) {
            $result[] = $entity->id;
        }

        return [
            'type' => $this->searchFields[$field]['type'],
            'operator' => key($this->searchFields[$field]['operators']),
            'value' => $result
        ];
    }