public function actionCreate()
 {
     $model = new Actor();
     if (isset($_POST['Actor'])) {
         $model->setAttributes($_POST['Actor']);
         $relatedData = array('films' => $_POST['Actor']['films'] === '' ? null : $_POST['Actor']['films']);
         if ($model->saveWithRelated($relatedData)) {
             if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                 Yii::app()->end();
             } else {
                 $this->redirect(array('view', 'id' => $model->actor_id));
             }
         }
     }
     $this->render('create', array('model' => $model));
 }