/**
  * Add portlet to first column, first position
  * and if there are other portlets in the first
  * column, shift their postion by 1 to accomodate
  * the new portlet
  *
  */
 public function actionAdd()
 {
     assert('!empty($_GET["uniqueLayoutId"])');
     assert('!empty($_GET["portletType"])');
     $maximumColumns = $this->resolveMaximumColumnsByDashboardId();
     $portletCollection = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition($_GET['uniqueLayoutId'], Yii::app()->user->userModel->id, array());
     if (!empty($portletCollection)) {
         if (isset($portletCollection[$maximumColumns])) {
             foreach ($portletCollection[$maximumColumns] as $position => $portlet) {
                 $portlet->position = $portlet->position + 1;
                 $portlet->save();
             }
         }
     }
     if (!empty($_GET['dashboardId'])) {
         $dashboardId = $_GET['dashboardId'];
     } else {
         $dashboardId = '';
     }
     Portlet::makePortletUsingViewType($_GET['portletType'], $_GET['uniqueLayoutId'], Yii::app()->user->userModel, $maximumColumns);
     $this->redirect(array('default/dashboardDetails', 'id' => $dashboardId));
 }
 /**
  * Add portlet to first column, first position
  * and if there are other portlets in the first
  * column, shift their postion by 1 to accomodate
  * the new portlet
  *
  */
 public function actionAdd()
 {
     assert('!empty($_GET["uniqueLayoutId"])');
     assert('!empty($_GET["portletType"])');
     $isPortletAlreadyAdded = Portlet::doesPortletExistByViewTypeLayoutIdAndUser($_GET['portletType'], $_GET['uniqueLayoutId'], Yii::app()->user->userModel->id);
     $maximumColumns = $this->resolveMaximumColumnsByLayoutId();
     if ($isPortletAlreadyAdded === false) {
         $this->resetPortletsInColumnToAccomodateNewPortlet($maximumColumns);
         Portlet::makePortletUsingViewType($_GET['portletType'], $_GET['uniqueLayoutId'], Yii::app()->user->userModel, intval($maximumColumns));
     }
     if (!empty($_GET['modelId'])) {
         $dashboardId = $_GET['modelId'];
     } else {
         $dashboardId = '';
     }
     //Please see @link:AccountDetailsAndRelationsPortletViewTest
     if (isset($_GET['redirect'])) {
         return;
     }
     $this->redirect(array('/' . $this->resolveAndGetModuleId() . '/default/details', 'id' => $dashboardId));
 }