function doUpload($data, $form)
 {
     // Gets a blog holders ID
     $blogHolderID = $data['BlogHolderID'];
     // Checks if a file is uploaded
     if (is_uploaded_file($_FILES['XMLFile']['tmp_name'])) {
         echo '<p>Processing...<br/></p>';
         flush();
         $file = $_FILES['XMLFile'];
         // check file type. only xml file is allowed
         if ($file['type'] != 'text/xml') {
             echo 'Please select Wordpress XML file';
             die;
         }
         $wp = new WpParser($file['tmp_name']);
         $posts = $wp->parse();
         // For testing only
         // TODO: remove $count
         $count = 0;
         echo $count;
         foreach ($posts as $post) {
             $comments = $post['Comments'];
             // create a blog entry
             $entry = new BlogEntry();
             $entry->ParentID = $blogHolderID;
             // $posts array and $entry have the same key/field names
             // so we can use update here.
             var_dump($post);
             $entry->update($post);
             $entry->write();
             $entry->publish("Stage", "Live");
             // page comment(s)
             foreach ($comments as $comment) {
                 $page_comment = new PageComment();
                 $page_comment->ParentID = $entry->ID;
                 $page_comment->update($comment);
                 $page_comment->write();
             }
             // count is used for testing only
             // TODO: remove the next 2 lines
             $count++;
         }
         // delete the temporaray uploaded file
         unlink($file['tmp_name']);
         // print sucess message
         echo 'Complete!<br/>';
         echo 'Please refresh the admin page to see the new blog entries.';
     }
 }