protected function prepareModels() {
		if(!$this->query instanceof QueryInterface) {
			throw new InvalidConfigException(
				'The "query" property must be an instance of a class that implements the '.
				'chsergey\rest\QueryInterface or its subclasses.'
			);
		}

		$query = clone $this->query;

		$this->setPagination([
			'pageSizeLimit' => [1, 1000]
		]);

		if (($pagination = $this->getPagination()) !== false) {
			$pagination->totalCount = $this->getTotalCount();
			$query->limit($pagination->getLimit())
				->offset($pagination->getOffset());
		}

		return $query->all();
	}