public function inPool($pool = null)
    {
        if (empty($pool)) {
            return $this;
        }
        $model = Yii::createObject($this->modelClass);

        if (!array_key_exists($pool, $model->ngRestPools())) {
            throw new InvalidConfigException("The requested pool identifier '{$pool}' does not exist in the ngRestPools() definition.");
        }

        return $this->andWhere($model->ngRestPools()[$pool]);
    }