public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrineManager();
        $entity = $em->getRepository('BisonLabSakonninBundle:MessageType')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find MessageType entity.');
        }

        $deleteForm = $this->createDeleteForm($id);
        $editForm = $this->createEditForm($entity);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();
            return $this->redirectToRoute('messagetype_show', array('id' => $entity->getId()));
        }

        return $this->render(
            'BisonLabSakonninBundle:MessageType:edit.html.twig', array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        ));
    }