public function getNewUniqRandomKey(ObjectRepository $repository, $field, $length)
    {
        $entity = true;
        while ($entity) {
            $random = $this->randomStr($length);
            $entity = $repository->findOneBy(array($field => $random));
        }

        return $random;
    }