public function editAction()
 {
     $id = (int) $this->params('id');
     if (!$id) {
         return $this->redirect()->toRoute('posts', array('action' => 'new'));
     }
     try {
         $post = $this->getPostTable()->getPost($id);
     } catch (\Exception $ex) {
         return $this->redirect()->toRoute('posts', array('action' => 'index'));
     }
     $table = $this->getServiceLocator()->get('Blog\\Model\\CategoryTable');
     $form = new PostForm($table);
     $form->bind($post);
     $form->get('submit');
     $request = $this->getRequest();
     if ($request->isPost()) {
         $form->setInputFilter($post->getInputFilter());
         $form->setData($request->getPost());
         if ($form->isValid()) {
             $this->getPostTable()->savePost($post);
             return $this->redirect()->toRoute('posts', array('action' => view, 'id' => $id));
         }
     }
     return array('id' => $id, 'form' => $form, 'post' => $post);
 }