public function saveAction()
 {
     $id = $this->request->getPost("id");
     $widget = Widget::findFirstByid($id);
     if ($this->request->getPost("column") != NULL) {
         $widget->column = $this->request->getPost("column");
     }
     if ($this->request->getPost("row") != NULL) {
         $widget->row = $this->request->getPost("row");
     }
     if ($this->request->getPost("portlet_id") != NULL) {
         $widget->canvas_id = $this->request->getPost("portlet_id");
     }
     if ($this->request->getPost("parameters") != NULL) {
         $widget->parameters = json_encode($this->request->getPost("parameters"), true);
     }
     if (!$widget->save()) {
         foreach ($widget->getMessages() as $message) {
             $this->flash->error($message);
         }
     } else {
         $this->flash->success("Widget was saved successfully");
         $portlet = Portlet::findFirstById($widget->portlet_id);
         $dashboard = Dashboard::findFirstById($portlet->dashboard_id);
         return $this->response->redirect("/dashboards/" . $dashboard->type . "/edit/" . $dashboard->id);
     }
 }