public function updateAction($id)
    {
        $em = $this->getDoctrine()->getEntityManager();

        $group = $em->getRepository('Orkestra\Bundle\ApplicationBundle\Entity\Group')->find($id);

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

        $form = $this->createForm(GroupType::class, $group);

        $form->bindRequest($this->getRequest());

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

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

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

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