/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Net();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Net'])) {
         $model->attributes = $_POST['Net'];
         if ($model->save()) {
             $pointsAttached = $_POST['Net']['pointsattached'];
             $pointToNet = new PointToNet();
             $pointToNet::model()->deleteAll('net_id = ' . $model->id);
             foreach ($pointsAttached as $attached) {
                 $pointToNet->attributes = array('net_id' => $model->id, 'point_id' => $attached);
                 $pointToNet->save();
                 $PointModel = Point::model()->findByPk($attached);
                 $PointModel->CreateChannelsForWindows($model->screen_id, $attached);
                 unset($PointModel);
                 $pointToNet = new PointToNet();
             }
             $model->CreateChannelsForWindows($model->screen_id, $model->id);
             $this->redirect(array('update', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }