public function actionUpdate($id)
    {
        $model = $this->findModel($id);
        
		$model->tags = !empty($model->tags)?explode(",",$model->tags):[];
		
		$post = Yii::$app->request->post();
		if (isset($post['Banner']['tags']))
		{
			if (is_array($post['Banner']['tags']))
			{
				$post['Banner']['tags'] = implode(",",$post['Banner']['tags']);
			}	
		}
		
		$transaction = Yii::$app->db->beginTransaction();
		try {				
			if ($model->load($post) && $model->save()) {
				$model->updatePosition($model->position);
				$transaction->commit();
				return $this->redirect(['view', 'id' => $model->id]);
			}					
			else
			{
				$transaction->rollBack();	
			}
		} catch (Exception $e) {
			$transaction->rollBack();
		}
		        
		return $this->render('update', [
			'model' => $model,
		]);
	
    }