protected function getPaginatorCriteriaByName(ServiceLocatorInterface $serviceLocator, $name)
    {
        $criteria = $serviceLocator->get($name);
        if (!$criteria instanceof PaginableCriteriaInterface) {
            throw new Exception\ServiceNotCreatedException(sprintf(
                'Instance of type "%s" is invalid; must implement "%s"',
                (is_object($criteria) ? get_class($criteria) : gettype($criteria)),
                PaginableCriteriaInterface::class
            ));
        }
        return $criteria;
    }