public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrineManager();
            $entity = $em->getRepository('BisonLabSakonninBundle:MessageType')->find($id);

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

            $em->remove($entity);
            $em->flush();
        }
        return $this->redirectToRoute('messagetype');
    }