//This methods Performs The Actions Based On The Issue Selected
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            try
            {
                var activity = await result;
                IssueCategory = activity.ToString();

                Rootobject rootobject = new Rootobject();

                rootobject = await LuisData.ReturnLuisData(IssueCategory);

                if (IssueCategory.Equals("Software Issue", StringComparison.InvariantCultureIgnoreCase))
                {
                    var replymessage = context.MakeMessage();
                    var herocard     = new ThumbnailCard
                    {
                        Subtitle = "What type of Software are you issue facing with?",
                        Buttons  = new List <CardAction> {
                            new CardAction(ActionTypes.ImBack, "Email", value: "EmailIssue"), new CardAction(ActionTypes.ImBack, "Antivirus", value: "AntiVirusIssue"), new CardAction(ActionTypes.ImBack, "Others", value: "OtherIssues")
                        }
                    };
                    replymessage.Attachments.Add(herocard.ToAttachment());
                    Logging.ConversationLogg(context.Activity.From.Name, IssueCategory, replymessage.ToString(), DateTime.Now, context.Activity.ChannelId);
                    await context.PostAsync(replymessage);
                }
                else if (IssueCategory.Equals("HardWare Issue", StringComparison.InvariantCultureIgnoreCase))
                {
                    var replymessage = context.MakeMessage();
                    var herocard     = new ThumbnailCard
                    {
                        Subtitle = "What type of HardWare are you issue facing with?",
                        Buttons  = new List <CardAction> {
                            new CardAction(ActionTypes.ImBack, "Laptop", value: "LaptopIssue"), new CardAction(ActionTypes.ImBack, "Printer", value: "PrinterIssue"), new CardAction(ActionTypes.ImBack, "Others", value: "OtherIssues")
                        }
                    };
                    replymessage.Attachments.Add(herocard.ToAttachment());
                    Logging.ConversationLogg(context.Activity.From.Name, IssueCategory, replymessage.ToString(), DateTime.Now, context.Activity.ChannelId);
                    await context.PostAsync(replymessage);

                    //context.Wait(MessageReceivedAsync);
                }
                else if (rootobject.entities[0].type.Equals("QuitFlow", StringComparison.InvariantCultureIgnoreCase))
                {
                    await context.PostAsync("ok");

                    context.Done(result);
                }
                //PromptDialog is used Inorder to Move To AfterSelectingIssue method
                PromptDialog.Text(
                    context: context,
                    resume: AfterSelectingIssue,
                    prompt: "Please Choose Your Issue Mentioned Above"
                    );
            }
            catch (Exception ex)
            {
                Logging.errorloginfo(ex.Message, DateTime.Now);
            }
        }
        //To Display An Rich card Wheather To raise The Ticket Or Not to
        private async Task IssueDescription(IDialogContext context, IAwaitable <object> result)
        {
            try
            {
                var activity = await result;
                IssueDescriptionNote = activity.ToString();
                Rootobject rootobject = new Rootobject();

                rootobject = await LuisData.ReturnLuisData(IssueDescriptionNote);

                if (rootobject.entities != null && rootobject.entities.Length != 0)
                {
                    if (rootobject.entities[0].type.Equals("QuitFlow", StringComparison.InvariantCultureIgnoreCase))
                    {
                        await context.PostAsync("ok");

                        context.Done(result);
                    }
                }
                else
                {
                    var replymessage = context.MakeMessage();
                    var herocard     = new ThumbnailCard
                    {
                        Text     = "Shall we Raise The Ticket Yes Or No",
                        Subtitle = "Ticket To Be Raised For Issue Category :" + IssueCategory + " , Issue With :" + IssueFacing + ",Issue Description :" + IssueDescriptionNote + "\n\n",
                        Buttons  = new List <CardAction> {
                            new CardAction(ActionTypes.ImBack, "Yes", value: "Yes"), new CardAction(ActionTypes.ImBack, "No", value: "No")
                        }
                    };
                    replymessage.Attachments.Add(herocard.ToAttachment());
                    await context.PostAsync(replymessage);

                    PromptDialog.Text(context, TicketGenerationResponse, "Click Yes Or No");
                }
            }
            catch (Exception ex)
            {
                Logging.errorloginfo(ex.Message, DateTime.Now);
            }
        }
        //To display the Final Response
        private async Task TicketGenerationResponse(IDialogContext context, IAwaitable <object> result)
        {
            try
            {
                var        activity       = await result;
                string     activityresult = activity.ToString().ToLower();
                Rootobject rootobject     = new Rootobject();
                rootobject = await LuisData.ReturnLuisData(activity.ToString());

                if (rootobject.entities != null && rootobject.entities.Length != 0)
                {
                    if (rootobject.entities[0].type.Equals("QuitFlow", StringComparison.InvariantCultureIgnoreCase))
                    {
                        await context.PostAsync("ok");

                        context.Done(result);
                    }
                }
                else if (activity.ToString().Equals("yes", StringComparison.InvariantCultureIgnoreCase))
                {
                    Logging.ItTicketLogging(context.Activity.From.Name, IssueCategory, IssueFacing, IssueDescriptionNote, DateTime.Now, context.Activity.ChannelId);
                    IssueCategory        = string.Empty;
                    IssueFacing          = string.Empty;
                    IssueDescriptionNote = string.Empty;
                    await context.PostAsync("Yeah Your Token Will Be Raised,Thank You.");

                    context.Done(result);
                }
                else if (activity.ToString().Equals("no", StringComparison.InvariantCultureIgnoreCase))
                {
                    await context.PostAsync("Ok");

                    context.Done(result);
                }
            }
            catch (Exception ex)
            {
                Logging.errorloginfo(ex.Message, DateTime.Now);
            }
        }
        // method to get the selected issues and check whether the entity type is Subcategory or  not
        private async Task AfterSelectingIssue(IDialogContext context, IAwaitable <object> result)
        {
            try
            {
                var activity = await result;
                IssueFacing = activity.ToString();
                Rootobject rootobject = new Rootobject();

                rootobject = await LuisData.ReturnLuisData(IssueFacing);

                if (rootobject.entities != null && rootobject.entities.Length != 0)
                {
                    if (rootobject.entities[0].type.Equals("QuitFlow", StringComparison.InvariantCultureIgnoreCase))
                    {
                        await context.PostAsync("ok");

                        context.Done(result);
                    }
                    else if (rootobject.entities != null && rootobject.entities[0].type == "Subcategory")
                    {
                        //context.Wait(AfterSelectingIssue);
                        PromptDialog.Text(
                            context: context,
                            resume: IssueDescription,
                            prompt: "Please describe your issue in few words"
                            );
                    }
                }
                else
                {
                    PromptDialog.Text(context, AfterSelectingIssue, "Please Select in The Issues Provided Mentioned above the list");
                    // await context.PostAsync("Please Select in The Issues Provided Mentioned above the list");
                    //context.Wait(AfterSelectingIssue);
                }
            }
            catch (Exception ex)
            {
                Logging.errorloginfo(ex.Message, DateTime.Now);
            }
        }
        /// <summary>
        /// This Method Is for The Intent And Entity which it gets from the luis it will maps according to that
        /// </summary>
        /// <param name="context"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            try
            {
                Rootobject rootobject = new Rootobject();
                //LuisData Luisdata = new LuisData();
                string BotResponseMessage;

                var Entity   = string.Empty;
                var activity = await result as Activity;

                var Userresponse = activity.Text;
                rootobject = await LuisData.ReturnLuisData(Userresponse);

                if (Userresponse.Equals("ChartsTesting", StringComparison.InvariantCultureIgnoreCase))
                {
                    string reply = string.Empty;

                    HttpClient     hclient        = new HttpClient();
                    HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("http://*****:*****@"
                    
             {{
	""$schema"": ""http://adaptivecards.io/schemas/adaptive-card.json"",
	""type"": ""AdaptiveCard"",
	""version"": ""1.0"",
	""body"": [
		{{
			""type"": ""Container"",
			""items"": [
				{{
					""type"": ""ColumnSet"",
					""columns"": [
						{{
							""type"": ""Column"",
							""width"": ""auto"",
							""items"": [
								{{  
                            ""type"": ""Image"",
                            ""url"": ""{url}"",
                            ""altText"":""{Userresponse}"",
                            ""size"": ""Stretch"",
								}}
							]
						}},
					]
				}}
			]
		}},
	],
	""actions"": [
		{{
			""type"": ""Action.Showcard"",
			""title"": ""Set due date"",
			""card"": {{
				""type"": ""AdaptiveCard"",
				""body"": [
					{{
						    ""type"": ""Image"",
                            ""url"": ""{MessagesController.chartUrl}"",
                            ""altText"":""{Userresponse}"",
                            ""size"": ""Stretch"",

					}},				
				],
			
			}}
		}},
	
	]
}}")
                    });
                    await context.PostAsync(message);

                    context.Wait(MessageReceivedAsync);



                    //-----------------------------------------------------------------------
//                       message.Attachments.Add(new Attachment()
//                    {
//                        ContentType = "application/vnd.microsoft.card.adaptive",
//                        Content = JObject.Parse($@"
//                 {{
//                ""$schema"": ""http://adaptivecards.io/schemas/adaptive-card.json"",
//              ""type"": ""AdaptiveCard"",
//              ""version"": ""1.0"",
//              ""body"": [
//                   {{
//                            ""type"": ""TextBlock"",
//                            ""text"": ""TOTAL GROWTH for in 2017 by VIEW""
//                        }},
//                        {{
//                            ""type"": ""Image"",
//                            ""url"": ""{MessagesController.chartUrl}"",
//                            ""altText"":""Not Loaded"",
//                            ""size"": ""Stretch"",
//                            ""horizontalAlignment"": ""right""
//                                }},
//            ],

//}}")
//                    });



                    //--------------------------------------------------------------------
                    //Random r = new Random();
                    //var CardAttachment = LuisData.CreateAdaptiveCardAttachment(this._cards[r.Next(this._cards.Length)]);
                    //var reply = context.MakeMessage();
                    //reply.Attachments = new List<Attachment>() { CardAttachment };
                    //await context.PostAsync(reply,CancellationToken.None);
                    //-------------------------------------------------------------------------------


                    //                    IMessageActivity messageActivity = context.MakeMessage();
                    //                    messageActivity.Attachments.Add(new Attachment()
                    //                    {
                    //                        ContentType = "application /vnd.microsoft.card.adaptive",
                    //                        Content = JObject.Parse(@"
                    //                      {

                    //                ""$schema"": ""http://adaptivecards.io/schemas/adaptive-card.json"",
                    //              ""type"": ""AdaptiveCard"",
                    //              ""version"": ""1.0"",
                    //              ""body"": [
                    //                     {
                    //                      ""type"": ""Column"",
                    //                      ""width"": ""auto"",
                    //                        ""items"": [
                    //                          {
                    //                            ""type"": ""TextBlock"",
                    //                            ""text"": ""This Is The Bar Graph""
                    //                        },
                    //                        {
                    //                            ""type"": ""Image"",
                    //                            ""url"":""data: image/png; base64,iVBORw0KGgoAAAANSUhEUgAAAlgAAAD6CAYAAAB9LTkQAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABWWSURBVHhe7d3bceNYlgVQlQ9pQJmi + aNBNGNMoC8yoj7qVyaMBxyCD5FUQrgbWRDyJs5aESe6RFGgtEmdu4Oq7n45AgCwKAULAGBhChYAwMIULACAhSlYAAALU7AAABamYAEALEzBAgBYmIIFALAwBQsAYGEKFgDAwhQsAICFKVgAAAtTsAAAFqZgAQAsTMECAFiYggUAsDAF6zd5fX09vry8 / DQ / fvw4 / vPPP8YYY8xm599//72ehtulYHVmKFm0Db+gtMmpTUYZOWXklKmQk9O8MwpWxhLLyKlNRhk5ZeSUqZCT07wzClbGEsvIqU1GGTll5JSpkJPTvDMKVsYSy8ipTUYZOWXklKmQk9O8MwpWxhLLyKlNRhk5ZeSUqZCT07wzClbGEsvIqU1GGTll5JSpkJPTvDMKVs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Xq73fOicvvZ8rV6uMdfwmNd8z49ze4yxay/x/fVyjRmG1+nD13zfa7zza3wjBavl/AReXtgfhhf87YkZPn99kQ4v+PvNf/ZbqT0a/7n+AF5DTcNjnBfi4wzXlNMnp+vt7193O2zHr/3w2Ccf3+vTY9+/1/v3P9x8u14v15jp6evuj9/3z7hyTk/XPXm8xsPnPr6P8823x7x/H6db79/3H3mN76NgTRqevOelf3tyhifqctv9F+Lp/p9fuNfbH5/Qvq/Roy9+rq55Dc12eow/52f8DTnNufZwuFzv+3gAD4fL7Rr3m4cD6naN26F10ss1Znm8xmNOnf+Mq+T0nM3j62X7v2tfXOObKFgAAAtTsAAAFqZgAQAsTMECAFiYggUAsDAFCwBgYQoWAMDCFCwAgIUpWAAAC1OwAAAWpmABACxMwQIAWJiCBQCwMAULAGBhChYAwMIULACAhSlYAAALU7AAABZ1PP4/5ZvBAnB5uW0AAAAASUVORK5CYII="",
                    //                            ""spacing"": ""none""
                    //                        }
                    //      ]
                    //    }
                    //]
                    //                }")
                    //                    });

                    //                    await context.PostAsync(messageActivity);
                    //                    context.Wait(MessageReceivedAsync);


                    //------------------------------------------------------------------------------------

                    //AdaptiveCard adaptivecard = new AdaptiveCard()
                    //{
                    //    Body = new List<CardElement>()
                    //    {
                    //        new Container()
                    //{
                    //   // speak = " < s > hello!</ s >< s > are you looking for a flight or a hotel ?</ s > ",
                    //    Items =  new List<CardElement>()
                    //    {
                    //        new ColumnSet()
                    //        {
                    //            Columns = new List<Column>()
                    //            {
                    //                new Column()
                    //                {
                    //                    Size = ColumnSize.Auto,
                    //                    Items = new List<CardElement>()
                    //                    {
                    //                        new Image()
                    //                        {
                    //                            Url = MessagesController.chartUrl,
                    //                            Size = ImageSize.Stretch,
                    //                            style = imagestyle.normal
                    //                        }
                    //                    }
                    //                },
                    //             }
                    //         }
                    //    }
                    //}
                    //    }
                    //};

                    //attachment attachment = new attachment()
                    //{
                    //    contenttype = adaptivecard.contenttype,
                    //    content = adaptivecard
                    //};

                    //var reply = context.makemessage();
                    //reply.attachments.add(attachment);
                    //await context.postasync(reply, cancellationtoken.none);



                    //--------------------------------------------------------------------------------------------------------


                    //string position = "right";
                    //var replymessage = context.MakeMessage();

                    //HeroCard plCard = new HeroCard()
                    //{
                    //    Images = new List<CardImage> { new CardImage("<img style="+"width:100%; max-height:100%;"+"src="+MessagesController.chartUrl+" />") }
                    //};
                    //replymessage.Text = string.Empty;
                    //replymessage.AttachmentLayout = AttachmentLayoutTypes.List;
                    //replymessage.Attachments = new List<Microsoft.Bot.Connector.Attachment>();
                    //Microsoft.Bot.Connector.Attachment plAttachment = plCard.ToAttachment();
                    //replymessage.Attachments.Add(plAttachment);
                    //await context.PostAsync(replymessage);
                    //return replyActivity;
                }


                //var card = new AdaptiveCard();
                //card.Body.Add(new Image()
                //{
                //    Url = MessagesController.chartUrl,
                //    Type = "Image",
                //    AltText = "sorry NotLoaded"

                //});
                //Attachment attachment = new Attachment()
                //{
                //    ContentType = AdaptiveCard.ContentType,
                //    Content = card
                //};
                //replymessage.Attachments.Add(attachment);
                //    await context.PostAsync(replymessage);


                //----------------------------------------------------------------------------------
                //var replymessage = context.MakeMessage();
                //var herocard = new HeroCard
                //{
                //    Images=new List<CardImage> { new CardImage("<img src=" + MessagesController.chartUrl + " alt=" + "Image Not Loaded" + " width=" + "500" + " height=" + "600" + ">") }
                //    //Buttons = new List<CardAction> { new CardAction(ActionTypes.ImBack, "Canada", value: "i want to book a meeting room In Canada"), new CardAction(ActionTypes.ImBack, "UK", value: "i want to book a meeting room In UK") }
                //};
                //replymessage.Attachments.Add(herocard.ToAttachment());
                //Logging.ConversationLogg(context.Activity.From.Name, activity.Text, replymessage.ToString(), DateTime.Now, context.Activity.ChannelId);
                //await context.PostAsync(replymessage);

                //-----------------------------------------------------

                if (rootobject.entities != null && rootobject.entities.Length != 0)
                {
                    if (rootobject.topScoringIntent.intent.Equals("RealEstateMeetingRoomReservationBook", StringComparison.InvariantCultureIgnoreCase) && rootobject.entities[0].entity.Equals("Canada", StringComparison.InvariantCultureIgnoreCase))
                    {
                        Intent             = rootobject.topScoringIntent.intent;
                        Entity             = rootobject.entities[0].entity;
                        BotResponseMessage = PostResponse.GetResponseFromBotForDynamicQuestions(Intent, Entity);
                        BotResponseMessage = BotResponseMessage.Replace("#", context.Activity.From.Name);
                        Logging.ConversationLogg(context.Activity.From.Name, activity.Text, BotResponseMessage, DateTime.Now, context.Activity.ChannelId);
                        await context.PostAsync(BotResponseMessage);

                        //await context.PostAsync(MessagesController.Conversationid);
                    }
                    else if (rootobject.topScoringIntent.intent.Equals("RealEstateMeetingRoomReservationBook", StringComparison.InvariantCultureIgnoreCase) && rootobject.entities[0].entity.Equals("UK", StringComparison.InvariantCultureIgnoreCase))
                    {
                        Intent             = rootobject.topScoringIntent.intent;
                        Entity             = rootobject.entities[0].entity;
                        BotResponseMessage = PostResponse.GetResponseFromBotForDynamicQuestions(Intent, Entity);
                        BotResponseMessage = BotResponseMessage.Replace("#", context.Activity.From.Name);
                        Logging.ConversationLogg(context.Activity.From.Name, activity.Text, BotResponseMessage, DateTime.Now, context.Activity.ChannelId);
                        await context.PostAsync(BotResponseMessage);
                    }
                    else if (rootobject.topScoringIntent.intent.Equals("ItTicketRaising", StringComparison.InvariantCultureIgnoreCase) && (rootobject.entities[0].type.Equals("Category", StringComparison.InvariantCultureIgnoreCase) || rootobject.entities[0].type.Equals("Subcategory", StringComparison.InvariantCultureIgnoreCase)))
                    {
                        ActivityValue = Userresponse;
                        context.Call(new GenerateItTicket(), AfterChoosencategory);
                    }
                    else
                    {
                        Intent             = rootobject.topScoringIntent.intent;
                        BotResponseMessage = PostResponse.GetResponseFromBotForStaticQuestions(Intent);
                        BotResponseMessage = BotResponseMessage.Replace("#", context.Activity.From.Name);
                        Logging.ConversationLogg(context.Activity.From.Name, activity.Text, BotResponseMessage, DateTime.Now, context.Activity.ChannelId);
                        await context.PostAsync(BotResponseMessage);
                    }
                }
                else
                {
                    if (rootobject.topScoringIntent.intent.Equals("RealEstateMeetingRoomReservationBook", StringComparison.InvariantCultureIgnoreCase) && rootobject.entities.Length == 0)
                    {
                        var replymessage = context.MakeMessage();
                        var herocard     = new ThumbnailCard
                        {
                            Text    = "Please Book the rooms in Below Locations Only",
                            Buttons = new List <CardAction> {
                                new CardAction(ActionTypes.ImBack, "Canada", value: "i want to book a meeting room In Canada"), new CardAction(ActionTypes.ImBack, "UK", value: "i want to book a meeting room In UK")
                            }
                        };
                        replymessage.Attachments.Add(herocard.ToAttachment());
                        Logging.ConversationLogg(context.Activity.From.Name, activity.Text, replymessage.ToString(), DateTime.Now, context.Activity.ChannelId);
                        await context.PostAsync(replymessage);
                    }

                    else if (rootobject.topScoringIntent.intent.Equals("Register", StringComparison.InvariantCultureIgnoreCase) && rootobject.entities.Length == 0)
                    {
                        Intent = rootobject.topScoringIntent.intent;
                        context.Call(new QuestionsDialog(), AfterChoosencategory);

                        //  questions = PostResponse.Questions(rootobject.topScoringIntent.intent);
                    }
                    else if (rootobject.topScoringIntent.intent.Equals("TicketsCount", StringComparison.InvariantCultureIgnoreCase) && rootobject.entities.Length == 0)
                    {
                        string SpecificUser = context.Activity.From.Name;
                        Tickets = PostResponse.TicketsLists(SpecificUser);
                        if (Tickets.Count != 0)
                        {
                            for (int i = 1; i <= Tickets.Count; i++)
                            {
                                TicketsGenerated += "<b>Ticket " + i + "</b> :- " + "  category is - " + Tickets[i - 1].IssueCategory + " ,Issue facing With - " + Tickets[i - 1].IssuefacingWith + " ,Description by you - " + Tickets[i - 1].IssueDescription + " ,  Time " + Tickets[i - 1].GeneratingTime + "<br/>";
                            }
                            var ticketsdisplaycard = context.MakeMessage();
                            var Herocard           = new HeroCard
                            {
                                Text = TicketsGenerated
                            };
                            ticketsdisplaycard.Attachments.Add(Herocard.ToAttachment());
                            Tickets.Clear();
                            TicketsGenerated = string.Empty;
                            await context.PostAsync(ticketsdisplaycard);
                        }
                        else
                        {
                            await context.PostAsync(" Sorry " + SpecificUser + ", You did not Raised Any Tickets Yet");
                        }
                    }
                    else if (rootobject.topScoringIntent.intent.Equals("RealEstateReceptionRegister", StringComparison.InvariantCultureIgnoreCase) && rootobject.entities.Length == 0)
                    {
                        Intent             = rootobject.topScoringIntent.intent;
                        Entity             = "";
                        BotResponseMessage = PostResponse.GetResponseFromBotForDynamicQuestions(Intent, Entity);
                        BotResponseMessage = BotResponseMessage.Replace("#", context.Activity.From.Name);
                        Logging.ConversationLogg(context.Activity.From.Name, activity.Text, BotResponseMessage, DateTime.Now, context.Activity.ChannelId);
                        await context.PostAsync(BotResponseMessage);
                    }
                    else if (rootobject.topScoringIntent.intent.Equals("RealEstateShuttleBusSchedule", StringComparison.InvariantCultureIgnoreCase) && rootobject.entities.Length == 0)
                    {
                        Intent             = rootobject.topScoringIntent.intent;
                        Entity             = "";
                        BotResponseMessage = PostResponse.GetResponseFromBotForDynamicQuestions(Intent, Entity);
                        BotResponseMessage = BotResponseMessage.Replace("#", context.Activity.From.Name);
                        Logging.ConversationLogg(context.Activity.From.Name, activity.Text, BotResponseMessage, DateTime.Now, context.Activity.ChannelId);
                        await context.PostAsync(BotResponseMessage);
                    }
                    else if (rootobject.topScoringIntent.intent.Equals("TravelBookITBook", StringComparison.InvariantCultureIgnoreCase) && rootobject.entities.Length == 0)
                    {
                        Intent             = rootobject.topScoringIntent.intent;
                        Entity             = "";
                        BotResponseMessage = PostResponse.GetResponseFromBotForDynamicQuestions(Intent, Entity);
                        BotResponseMessage = BotResponseMessage.Replace("#", context.Activity.From.Name);
                        Logging.ConversationLogg(context.Activity.From.Name, activity.Text, BotResponseMessage, DateTime.Now, context.Activity.ChannelId);
                        await context.PostAsync(BotResponseMessage);
                    }
                    else if (rootobject.topScoringIntent.intent.Equals("ItTicketRaising", StringComparison.InvariantCultureIgnoreCase) && rootobject.entities.Length == 0)
                    {
                        ActivityValue = Userresponse;
                        context.Call(new GenerateItTicket(), AfterChoosencategory);
                    }
                    else if (rootobject.topScoringIntent.intent.Equals("VisitorBadgeRequest", StringComparison.InvariantCultureIgnoreCase))
                    {
                        ActivityValue = Userresponse;
                        context.Call(new VisitorBadgeDialog(), AfterChoosencategory);
                    }
                    else
                    {
                        Intent             = rootobject.topScoringIntent.intent;
                        BotResponseMessage = PostResponse.GetResponseFromBotForStaticQuestions(Intent);
                        //BotResponseMessage = BotResponseMessage.Replace("$", System.Environment.NewLine);
                        BotResponseMessage = BotResponseMessage.Replace("#", context.Activity.From.Name);
                        Logging.ConversationLogg(context.Activity.From.Name, activity.Text, BotResponseMessage, DateTime.Now, context.Activity.ChannelId);
                        await context.PostAsync(BotResponseMessage);
                    }
                }
            }
            catch (Exception ex)
            {
                Logging.errorloginfo(ex.Message, DateTime.Now);
                await context.PostAsync(ex.Message);
            }
        }