public function editAction()
    {
        static $typeToMime = array(
            'css'   => 'text/css',
            'js'    => 'text/javascript',
        );

        /* @var $form \Zork\Form\Form */
        $params     = $this->params();
        $request    = $this->getRequest();
        $locator    = $this->getServiceLocator();
        $model      = $locator->get( 'Grid\Paragraph\Model\Snippet\Model' );
        $snippet    = $model->find( $params->fromRoute( 'name' ) );
        $form       = $locator->get( 'Form' )
                              ->create( 'Grid\Paragraph\Snippet\Edit' );

        if ( empty( $snippet ) )
        {
            $this->getResponse()
                 ->setStatusCode( 404 );

            return;
        }

        $type = $snippet->type;

        if ( ! empty( $typeToMime[$type] ) )
        {
            $form->get( 'code' )
                 ->setAttribute(
                     'data-js-codeeditor-mode',
                     $typeToMime[$type]
                 );
        }

        /* @var $form \Zend\Form\Form */
        $form->setHydrator( $model->getMapper() )
             ->bind( $snippet );

        if ( $request->isPost() )
        {
            $form->setData( $request->getPost() );

            if ( $form->isValid() && $snippet->save() )
            {
                $this->messenger()
                     ->add( 'paragraph.form.snippet.success',
                            'paragraph', Message::LEVEL_INFO );

                return $this->redirect()
                            ->toRoute( 'Grid\Paragraph\Snippet\List', array(
                                'locale' => (string) $this->locale(),
                            ) );
            }
            else
            {
                $this->messenger()
                     ->add( 'paragraph.form.snippet.failed',
                            'paragraph', Message::LEVEL_ERROR );
            }
        }

        $form->setCancel(
            $this->url()
                 ->fromRoute( 'Grid\Paragraph\Snippet\List', array(
                        'locale' => (string) $this->locale(),
                    ) )
        );

        return array(
            'form'      => $form,
            'snippet'   => $snippet,
        );
    }