public static function save_blogpost($cid, $uid, $title, $body, $track, $tags, $ccid = 0, $is_active = 1, $display_on = 0, $is_default_content = FALSE)
 {
     $errors = array();
     // ensure integers here
     $cid = (int) $cid;
     $uid = (int) $uid;
     $ccid = (int) $ccid;
     // if a new post, make one, otherwise load the existing one
     if ($cid) {
         $post = CNContent::load_content($cid, $uid);
         // ignore $ccid passed to function if the post already exists
         // - we don't allow users to move posts between
         // CNContentCollections.
         $ccid = (int) $post->parent_collection_id;
     } else {
         $post = new CNBlogPost();
         $post->author_id = $uid;
         if ($ccid) {
             $post->parent_collection_id = $ccid;
         }
     }
     if ($ccid && $ccid != -1) {
         $g = ContentCollection::load_collection($ccid, $uid);
         $g->assert_user_access($uid);
     } else {
         $g = NULL;
     }
     $post->title = $title;
     $post->body = $body;
     $post->allow_comments = 1;
     $post->is_active = $is_active;
     $post->display_on = $display_on;
     $post->trackbacks = '';
     if ($track) {
         $post->trackbacks = implode(",", $track);
     }
     $post->is_default_content = $is_default_content;
     $post->save();
     //if ($tags) {
     Tag::add_tags_to_content($post->content_id, $tags);
     //}
     if ($track) {
         foreach ($track as $t) {
             if (!$post->send_trackback($t)) {
                 $errors[] = array("code" => "trackback_failed", "msg" => "Failed to send trackback", "url" => $t);
             }
         }
     }
     if ($g && !$cid) {
         // new post - post it to the group as well
         $g->post_content($post->content_id, $uid);
     }
     return array("cid" => (int) $post->content_id, "moderation_required" => $g ? $g->is_moderated == 1 && $g->author_id != $uid : FALSE, "errors" => $errors);
 }