public function actionCreate()
 {
     $this->breadcrumbs = array('My Wish Lists' => $this->createUrl("/wishlist"), 'Create a Wish List' => $this->createUrl("wishlist/create"));
     //We should only show this option to a logged in user
     if (Yii::app()->user->isGuest) {
         _xls_404();
     }
     $model = new Wishlist();
     // collect user input data
     if (isset($_POST['Wishlist'])) {
         $model->attributes = $_POST['Wishlist'];
         if ($model->validate()) {
             $model->customer_id = Yii::app()->user->id;
             $model->gift_code = md5(uniqid());
             if (!$model->save()) {
                 Yii::log("Error creating Wish List " . print_r($model->getErrors(), true), 'error', 'application.' . __CLASS__ . '.' . __FUNCTION__);
             }
             $this->redirect($this->createUrl("wishlist/view", array('code' => $model->gift_code)));
         }
     } else {
         //Set up defaults
         $model->visibility = Wishlist::PERSONALLIST;
         $model->after_purchase = Wishlist::LEAVEINLIST;
     }
     $this->render('create', array('model' => $model));
 }