public function getReferencesForModelMetaReference(ModelMetaReferenceInterface $referenceData, $search = null)
    {
        $modelClass = $referenceData->model();

        $query = $this->getQueryBuilderForModelClass($modelClass);

        $this->applySortingToQueryBuilder(
            $query,
            $referenceData->source(),
            $referenceData->sortDirection(),
            $referenceData->sortStrategy()
        );

        if (null !== $search) {
            $this->applySearchTermFilterToQueryBuilder($query, $referenceData->target(), $search);
        }

        // If set, apply an (extra) contextual modification to the query builder
        if ($referenceData->contextStrategy()) {
            $this->applyContextStrategyToQueryBuilder(
                $query,
                $referenceData->contextStrategy(),
                $referenceData->parameters()
            );
        }

        /** @var Collection|Model[] $models */
        $models = $query->get();

        // Get references for query results, keyed by primary key
        $references = [];

        foreach ($models as $model) {

            $references[ $model->getKey() ] = $this->getReferenceForModel(
                $model,
                $referenceData->strategy(),
                $referenceData->source()
            );
        }

        return new Collection($references);
    }