public function saveItemAsArticle($item)
 {
     $table = JTableContent::getInstance('content', 'JTable');
     $article = array();
     $article['id'] = 0;
     $article['catid'] = $this->categories[$item->catid];
     $article['alias'] = $item->alias;
     $article['title'] = $item->title;
     $article['state'] = $item->published;
     $article['publish_up'] = $item->publish_up;
     $article['publish_down'] = $item->publish_down;
     $article['introtext'] = $item->introtext;
     $article['fulltext'] = $item->fulltext;
     $article['created'] = $item->created;
     $article['modified'] = $item->modified;
     $article['created_by'] = $item->created_by;
     $article['modified_by'] = $item->modified_by;
     $article['hits'] = $item->hits;
     $article['language'] = $item->language;
     if (file_exists(JPATH_BASE . '/media/k2/items/cache/' . md5("Image" . $item->id) . '_L.jpg')) {
         $images['image_intro'] = 'media/k2/items/cache/' . md5("Image" . $item->id) . '_L.jpg';
         $images['image_intro_caption'] = $item->image_caption;
         $images['image_intro_alt'] = $item->image_credits;
         $images['image_fulltext'] = 'media/k2/items/cache/' . md5("Image" . $item->id) . '_XL.jpg';
         $images['image_fulltext_caption'] = $item->image_caption;
         $images['image_fulltext_alt'] = $item->image_credits;
     }
     $k2tags = $this->getK2ItemTags($item->id);
     $recipetags = array();
     if ($k2tags) {
         foreach ($k2tags as $key => $k2tag) {
             $recipetags[] = $this->getTagId($k2tag->name);
         }
     }
     //$article['tags'] = $recipetags ;
     $table->newTags = $recipetags;
     $article['images'] = json_encode($images);
     $retval = $table->save($article);
     if ($retval) {
         $item_pk = $table->getPrimaryKey();
         $pk = $item_pk['id'];
         $this->out($item->title . " saved. item_pk = " . $pk);
         $this->article_ids[$pk] = $item->id;
     } else {
         $this->out("Failed to save " . $item->title . " Error: " . $table->getError());
     }
     // update rating
     $query = "INSERT INTO `#__content_rating` (content_id,rating_sum,rating_count,lastip) SELECT " . $pk . ",rating_sum,rating_count,lastip FROM `#__k2_rating` WHERE itemID = " . $item->id . " ;";
     $query_set = $this->dbo->setQuery($query);
     $this->dbo->execute();
 }