public function actionRelationCall($arrayIndex, $id, $modelClass, $query = null)
    {
        $this->checkAccess('relation-call');
        
        $modelClass = base64_decode($modelClass);
        $model = $modelClass::findOne((int) $id);
        
        if (!$model) {
            throw new InvalidCallException("Unable to resolve relation call model.");
        }
        
        /** @var $relation \luya\admin\ngrest\base\NgRestRelationInterface */
        $relation = $model->getNgRestRelationByIndex($arrayIndex);

        if (!$relation) {
            throw new InvalidCallException("Unable to find the given ng rest relation for this index value.");
        }

        $find = $relation->getDataProvider();
        
        if ($find instanceof ActiveQuery && !$find->multiple) {
            throw new InvalidConfigException("The relation definition must be a hasMany() relation.");
        }
        
        if ($find instanceof ActiveQueryInterface) {
            $find->with($this->getWithRelation('relation-call'));
        }

        $this->appendPoolWhereCondition($find);

        $targetModel = Yii::createObject(['class' => $relation->getTargetModel()]);

        if ($query) {
            foreach ($targetModel->getNgRestPrimaryKey() as $pkName) {
                $searchQuery = $targetModel->ngRestFullQuerySearch($query)->select([$targetModel->tableName() . '.' . $pkName]);
                $find->andWhere(['in', $targetModel->tableName() . '.' . $pkName, $searchQuery]);
            }
        }

        return new ActiveDataProvider([
            'query' => $find,
            'pagination' => $this->pagination,
            'sort' => [
                'attributes' => $this->generateSortAttributes($targetModel->getNgRestConfig()),
            ]
        ]);
    }