public function prepareFormData(ApplicationEvent $e)
    {
        $target = $e->getTarget();
        if ($target->isPostRequest()) {
            return;
        }
        
        $this->application = $target->getApplicationEntity();
        $status = $target->getStatus();
        $user = $target->getUser();
        $settings = $user->getSettings('Applications');

        /* @var \Applications\Mail\StatusChange $mail */
        $mail = $this->mailService->get('Applications/StatusChange');

        switch ($status) {
            case Status::CONFIRMED:
                $key = 'mailConfirmationText';
                break;
            case Status::INVITED:
                $key = 'mailInvitationText';
                break;
            case Status::ACCEPTED:
                $key = 'mailAcceptedText';
                break;
            case Status::REJECTED:
                $key = 'mailRejectionText';
                break;
            default:
                throw new \InvalidArgumentException('Unknown status value: ' .$status);
        }
        $mailText      = $settings->$key ? $settings->$key : '';
        $mail->setBody($mailText);
        $mail->setApplication($this->application);
        $mailText = $mail->getBodyText();
        $mailSubject   = sprintf(
            $this->translator->translate('Your application dated %s'),
            strftime('%x', $this->application->getDateCreated()->getTimestamp())
        );

        $data = array(
            'applicationId' => $this->application->getId(),
            'status'        => $status,
            'mailSubject'   => $mailSubject,
            'mailText'      => $mailText,
            'to'            => $this->getRecipient($this->application, $status),
        );
        $target->setFormData($data);
    }