protected function createCountQuery($collection, $alias = 'o') {
        return $this->getEntityManager()->createQueryBuilder()
            ->select('COUNT(' . $alias . ')')
            ->from($collection, $alias);
    }