public function findGroupsByNames(array $names)
    {
        $nameCount = count($names);
        $dql = '
            SELECT g FROM Claroline\CoreBundle\Entity\Group g
            WHERE g.name IN (:names)
        ';

        $query = $this->_em->createQuery($dql);
        $query->setParameter('names', $names);

        $result = $query->getResult();

        if (($groupCount = count($result)) !== $nameCount) {
            throw new MissingObjectException("{$groupCount} out of {$nameCount} groups were found");
        }

        return $result;
    }