public function index(ServerRequestInterface $request)
    {
        if ($this->shouldCheckPermissions()) {
            $authenticated_user = $this->getAuthenticatedUser($request);

            if (!$this->canList($authenticated_user)) {
                return new ForbiddenStatusResponse();
            }
        }

        $collection_class = $this->getCollectionClassName();

        /** @var CollectionInterface $collection */
        $collection = $this->$collection_class;

        if ($collection instanceof CollectionInterface) {
            if ($collection->isPaginated()) {
                return $collection->currentPage($this->getPageFromQueryParams($request->getQueryParams()));
            } else {
                return $collection;
            }
        } else {
            throw new CollectionNotFoundException(get_class($this), __FUNCTION__, $collection_class);
        }
    }