public function findByCode($code)
    {
        try {
            $qb = $this->createQueryBuilder('currency')
                ->andWhere('currency.code = :currencyCode')
                ->setParameter('currencyCode', $code);

            return $qb->getQuery()->getSingleResult();
        } catch (NoResultException $exc) {
            return null;
        }
    }