public function actionEdit($id)
 {
     $model = Snippet::model()->findByPk($id);
     if (!$model) {
         throw new CHttpException(404);
     }
     $data = Yii::app()->request->getPost('Snippet');
     if ($data) {
         $model->setAttributes($data);
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('edit', array('model' => $model));
 }