public function findSameCategoryProduct($product, $direction)
    {
        $qb = $this->getQueryBuilder()
            ->select('p')
            ->andWhere('p.category = :category')
            ->setMaxResults(1)
            ->setParameter('category', $product->getCategory());

        if ('next' == $direction) {
            $qb->andWhere('p.id > :id')
                ->orderBy('p.id', 'asc');
        } else {
            $qb->andWhere('p.id < :id')
                ->orderBy('p.id', 'desc');
        }

        $qb->setParameter('id', $product->getId());

        if (0 == count($qb->getQuery()->getResult())) {
            return null;
        }

        return $qb->getQuery()
            ->getSingleResult();
    }