private void handleRemoveBlogContent(HttpContext ctx, Notification mirror, String requestPayload) { // create new string builder to hold the response StringBuilder response = new StringBuilder(); // access the credential state IAuthorizationState credentialState = DAL.RetrieveCredentialsByRequestIdAndUserToken(mirror.UserToken, mirror.VerifyToken); // get auth code from the verify token String authCode = DAL.RetrieveAuthCodeByRequestId(mirror.VerifyToken); // we can reuse the access token IAuthenticator credentials = Authorization.GetAuthenticatorFromState(credentialState); // get active blogger link BlogLink bl = DAL.GetActiveBlogLinkByUserId(mirror.UserToken); // get the speakable text TimelineItem timelineItem = Mirror.getTimelineItem(Mirror.BuildService(credentials), mirror.ItemId); try { // the inreply to is the specific post we are dealing with PostManager pm = DAL.GetPostManager(mirror, mirror.ItemId); if (pm.itemId != "-1") { // remove the post from blogger Blogger.deletePost(Blogger.BuildService(credentials), bl, pm); // remove the post from the service DAL.RemovePostManagerEntry(pm); // remove the timeline item Mirror.DeleteTimelineItem(Mirror.BuildService(credentials), pm.itemId); } } catch (Exception ex) { // notify user of exception DAL.InsertAccessLog(mirror.VerifyToken, mirror.UserToken, ex.ToString()); response.Append("<article>\n <section>\n <div class=\"text-auto-size\" style=\"\">\n <p class=\"red\">Unable to Remove Post</p>\n <p>Problem with Removing Post</p>\n </div>\n </section>\n <footer>\n <div>please share again later</div>\n </footer>\n</article>\n"); timelineItem = Mirror.insertTimelineItem(Mirror.BuildService(credentials), response.ToString(), true); return; } return; }