public function getEmail($reference)
    {
        if (!isset($this->emails[$reference])) {
            $this->emails[$reference] = $this->em->getRepository($this->options['email_class'])->findOneByReference($reference);
        }

        $email = $this->emails[$reference];

        if (!$email instanceof EmailInterface) {
            throw new ReferenceNotFoundException($reference, sprintf('Reference "%s" does not exist for email.', $reference));
        }

        return $email;
    }