protected function getQueryBuilder($repositoryMethod)
    {
        $repository = $this
            ->getDriver()
            ->getDoctrineOrmEm()
            ->getRepository($this->getDriver()->getEntityFqn())
        ;

        $repositoryMethods = $this->getDriver()->getEntityRepositorySearchableMethods();

        if (!method_exists($repository, $repositoryMethods[$repositoryMethod])) {
            return $repository->createQueryBuilder($this->getDriver()->getEntityAlias());
        }

        $queryBuilder = $repository->{$repositoryMethods[$repositoryMethod]}();

        if (!$queryBuilder instanceof QueryBuilder) {
            throw new ResourceException(sprintf(
                'The method "%s" of repository class must be return a %s instance',
                $repositoryMethods[$repositoryMethod],
                '\Doctrine\ORM\QueryBuilder'
            ));
        }

        return $queryBuilder;
    }