/**
  * Call the youtube factory function to get and update the video entries
  */
 public function handleSyncWithFacebook($gridField, $request = null)
 {
     // Trigger API to sync posts
     FacebookAPI::inst()->syncPosts();
     // Trigger API to sync pics
     FacebookAPI::inst()->syncPics();
     // Redirect to the grid overview
     Controller::curr()->redirectBack();
 }
 public function run($request)
 {
     echo "Facebook posts are being synced...\n";
     FacebookAPI::inst()->syncPosts();
     echo FacebookPost::get()->count() . " posts have been synced.\n\n";
     echo "Facebook timeline pics are being synced...\n";
     FacebookAPI::inst()->syncPics();
     echo FacebookTimelinePic::get()->count() . " pics have been synced.\n\n";
     echo "Facebook sync done!\n";
 }