private function persistEmailMessage(Message $message, $type, $status, $arguments)
 {
     $email = new Email();
     $email->setType($type);
     $email->setBody($message->getMessage());
     $email->setEmailAddress($message->getTo());
     $email->setFrom($message->getFrom());
     $email->setSubject($message->getSubject());
     $email->setArguments($arguments);
     $email->setStatus($status);
     $this->documentManager->persist($email);
     $this->documentManager->flush();
 }
 public function getLogContext()
 {
     $context = array('from' => $this->message->getFrom(), 'subject' => $this->message->getSubject(), 'body' => $this->message->getMessage());
     return array_merge(parent::getLogContext(), $context);
 }
 private function constructEmailMessage($type, $emailAddress, $arguments)
 {
     $message = new Message();
     $message->setTo($emailAddress);
     $message->setMessage($this->renderTempalate($type, $arguments));
     $message->setSubject($this->getSubject($type, $arguments));
     $message->setFrom($this->getFrom($type));
     return $message;
 }