public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();
        $user = $em->getRepository('Orkestra\Bundle\ApplicationBundle\Entity\User')->find($id);

        if (!$user) {
            throw $this->createNotFoundException('Unable to locate User');
        }

        $form = $this->createForm(UserType::class, $user, array('include_password' => false));
        $form->bind($request);

        if ($form->isValid()) {
            $em->persist($user);
            $em->flush();

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

            return $this->redirect($this->generateUrl('orkestra_user_show', array('id' => $id)));
        }

        return array(
            'user' => $user,
            'form' => $form->createView(),
        );
    }