function contact(Application $app, Request $request)
 {
     $form = $app['form.factory']->create(new ContactForm($app['currentUser']));
     if ('POST' == $request->getMethod()) {
         $form->bind($request);
         if ($form->isValid()) {
             $data = $form->getData();
             $contact = new ContactSupportModel();
             $contact->setSubject($data['subject']);
             $contact->setMessage($data['message']);
             $contact->setEmail($data['email']);
             if ($app['currentUser']) {
                 $contact->setUserAccountId($app['currentUser']->getId());
             }
             $contact->setIp($_SERVER['REMOTE_ADDR']);
             $contact->setBrowser($_SERVER['HTTP_USER_AGENT']);
             if ($request->request->get('url')) {
                 $contact->setIsSpamHoneypotFieldDetected(true);
             }
             $contactSupportRepository = new ContactSupportRepository();
             $contactSupportRepository->create($contact);
             if (!$contact->getIsSpam()) {
                 $contact->sendEmailToSupport($app, $app['currentUser']);
             }
             $app['flashmessages']->addMessage('Your message has been sent');
             return $app->redirect('/contact');
         }
     }
     return $app['twig']->render('index/index/contact.html.twig', array('form' => $form->createView()));
 }
 protected function build($id, Request $request, Application $app)
 {
     $this->parameters = array('user' => null);
     $csr = new ContactSupportRepository();
     $this->parameters['contactsupport'] = $csr->loadById($id);
     if (!$this->parameters['contactsupport']) {
         $app->abort(404);
     }
     if ($this->parameters['contactsupport']->getUserAccountId()) {
         $ur = new UserAccountRepository();
         $this->parameters['user'] = $ur->loadByID($this->parameters['contactsupport']->getUserAccountId());
     }
 }