/**
  * Cria ou edita um post
  * @return void
  */
 public function saveAction()
 {
     $form = new CommentForm();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $comment = new Comment();
         $form->setData($request->getPost());
         if ($form->isValid()) {
             $data = $form->getData();
             $data['comment_date'] = date('Y-m-d H:i:s');
             $comment->exchangeArray($data);
             $saved = $this->getTable('Admin\\Entity\\Comment')->save($comment);
             if ($saved) {
                 $this->flashMessenger()->setNamespace('success')->addMessage('Comentário salvo com sucesso.');
             } else {
                 $this->flashMessenger()->setNamespace('danger')->addMessage('Não foi possível salver esse comentário.
                                                      Tente novamente mais tarde.');
             }
             return $this->redirect()->toUrl('/admin/comments/index');
         } else {
             $this->flashMessenger()->setNamespace('danger')->addMessage('Post não foi salvo. Erro de validação.');
         }
     }
     $id = (int) $this->params()->fromRoute('id', 0);
     if ($id > 0) {
         $comment = $this->getTable('Admin\\Entity\\Comment')->get($id);
         $form->bind($comment);
         $form->get('submit')->setAttribute('value', 'Edit');
     }
     $form->get('posts_id')->setValueOptions($this->getService('Admin\\Model\\PostModel')->getPostsToPopuleSelect());
     return new ViewModel(array('form' => $form));
 }