protected function videopostsStep3()
 {
     $entries = $_POST['entries'];
     $createdPosts = 0;
     $uiConfId = $_POST['uiconf_id'];
     $width = $_POST['width'];
     $height = $_POST['height'];
     foreach ($entries as $entryCat) {
         $arr = unserialize(base64_decode($entryCat));
         $entryId = $arr[0];
         $entryName = $arr[1];
         $categoryName = $arr[2];
         // do we need to create new category?
         if (!Kaltura_WPModel::isCategoryExists($categoryName)) {
             $newCat = array('cat_name' => $categoryName);
             wp_insert_category($newCat);
             wp_cache_set('last_changed', microtime(true), 'terms');
             // otherwise the category won't return when retrieving it later in the code
         }
         $category = Kaltura_WPModel::getCategoryByName($categoryName);
         // create the post for the video
         $shortCode = "[kaltura-widget uiconfid=\"{$uiConfId}\" entryid=\"{$entryId}\" width=\"{$width}\" height=\"{$height}\" /]";
         $newPost = array('post_title' => $entryName, 'post_content' => $shortCode);
         $postId = wp_insert_post($newPost);
         if ($postId) {
             $createdPosts++;
         }
         // link the post to the category
         $categories = wp_get_post_categories($postId);
         $categories[] = $category->cat_ID;
         wp_set_post_categories($postId, $categories);
     }
     $params['numOfCreatedPosts'] = $createdPosts;
     $this->renderView('library/video-posts-screen-3.php', $params);
 }