public function count(QueryParameters $queryParameters = null) {
        return (int) $this->getQuery(
            $this->entities->createCountQuery(),
            $queryParameters
        )->getSingleScalarResult();
    }