protected function serializePagination($pagination)
    {
        if ($this->serializedPagination !== null) {
            return $this->serializedPagination;
        }
        /** @var \yii\rest\Serializer $serializer */
        $serializer = $this->serializer;
        return $this->serializedPagination = [
            $serializer->linksEnvelope => \yii\web\Link::serialize($pagination->getLinks(true)),
            $serializer->metaEnvelope => [
                'totalCount' => $pagination->totalCount,
                'pageCount' => $pagination->getPageCount(),
                'currentPage' => $pagination->getPage() + 1,
                'perPage' => $pagination->getPageSize(),
            ],
        ];
    }