public function updateAction(Request $request)
    {
        $user = $this->getUser();
        $form = $this->createForm(ProfileType::class, $user);

        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();

            try {
                $em->persist($user);
                $em->flush();

                $this->get('session')->getFlashBag()->set('success', 'Your changes have been saved.');

                return new JsonReloadResponse();
            } catch (\Exception $e) {
                $form->addError(new FormError('Could not save changes. If the problem persists, please contact support.'));
            }
        }

        return new JsonErrorResponse($form);
    }