private async Task <DialogTurnResult> InterruptAsync(DialogContext innerDc, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (innerDc.Context.Activity.Type != ActivityTypes.Message || innerDc.Context.Activity.Text == null || innerDc.Context.Activity.Speak == null)
            {
                return(null);
            }

            var text = innerDc.Context.Activity.Text.ToLowerInvariant();

            var result = await LuisHelper.GetLuisResult(this.configuration, text).ConfigureAwait(false);

            if (result?.TopScoringIntent == null)
            {
                return(null);
            }

            switch (result.TopScoringIntent.Intent)
            {
            case "signout":
                await this.authHelper.SignOutAsync(innerDc.Context.Activity);

                await innerDc.Context.SendActivityAsync(MessageFactory.Text("You have been signed out."), cancellationToken);

                return(await innerDc.CancelAllDialogsAsync(cancellationToken));

            case "Calendar.Cancel":
                await innerDc.Context.SendActivityAsync($"Cancelling", cancellationToken : cancellationToken);

                return(await innerDc.CancelAllDialogsAsync(cancellationToken));
            }

            return(null);
        }
        private async Task <DialogTurnResult> StartAsync(DialogContext innerDc)
        {
            string response        = string.Empty;
            string botResponseType = string.Empty;
            string activityText    = string.Empty;
            string message         = innerDc.Context.Activity.Text;
            bool   isIntentFound   = false;

            message   = message.ToLower().Replace("bang", "bdc");
            userQuery = await _accessors.UserQueryAccessor.GetAsync(innerDc.Context, () => new UserQuery());

            ConversationData conversationData =
                await _accessors.ConversationDataAccessor.GetAsync(innerDc.Context, () => new ConversationData());

            // Get the LuisModel
            LuisResult luisResult = await LuisHelper.GetLuisResult(message, _config);

            // Making userquery to be null If user moves from one Module to another
            if (string.IsNullOrEmpty(userQuery.LuisIntent))
            {
                userQuery.LuisIntent = luisResult.TopScoringIntent.Intent;
            }
            if (!(luisResult.TopScoringIntent.Intent == userQuery.LuisIntent))
            {
                string eid = userQuery.EnterpriseId;
                userQuery = new UserQuery();
                userQuery.EnterpriseId = eid; eid = null;
                await _accessors.UserQueryAccessor.SetAsync(innerDc.Context, userQuery);

                await _accessors.UserState.SaveChangesAsync(innerDc.Context);

                luisResult = await LuisHelper.GetLuisResult(message, _config);
            }


            // Get the Entities and its values.
            GetUserData(luisResult, userQuery);
            await _accessors.UserQueryAccessor.SetAsync(innerDc.Context, userQuery);

            await _accessors.UserState.SaveChangesAsync(innerDc.Context);

            // Log LUIS Logs
            await _sqlLoggerRepository.InsertLuisLogs(innerDc.Context, luisResult, userQuery.EnterpriseId);

            //await innerDc.Context.GetUserQuery
            if ((luisResult.TopScoringIntent.Score > Convert.ToDouble(_config["Luis:Threshold"])) &&
                (luisResult.TopScoringIntent.Intent != null) &&
                (luisResult.TopScoringIntent.Intent != LuisConstants.NoneIntent))
            {
                //_ApiInput = new ApiInputDetails() { Input = Utilities.GetCorpusInput(innerDc.Context, luisResult), ApiIdentifier = "Luis" };
                //var res = LuisHelper.GetApiResponseAsync(_config, _ApiInput);
                switch (luisResult.TopScoringIntent.Intent)
                {
                case "GetAdhocRequestDetails":
                    isIntentFound = true;
                    await innerDc.BeginDialogAsync(nameof(GetAdhocRequestDetails), luisResult);

                    break;

                case "ViewRoute":
                    isIntentFound = true;
                    await innerDc.BeginDialogAsync(nameof(ViewRoute), luisResult);

                    break;

                case "GetScheduleDetails":
                    isIntentFound = true;
                    await innerDc.BeginDialogAsync(nameof(ViewSchedule), luisResult);

                    break;

                case "ViewOTP":
                    isIntentFound = true;
                    await innerDc.BeginDialogAsync(nameof(ViewOTP), luisResult);

                    break;

                case "CancelTrip":
                    isIntentFound = true;
                    await innerDc.BeginDialogAsync(nameof(CancelTrip), luisResult);

                    break;

                case "GetAdhocStatus":
                    isIntentFound = true;
                    await innerDc.BeginDialogAsync(nameof(AdhocStatus), luisResult);

                    break;

                default:
                    isIntentFound = true;
                    await innerDc.BeginDialogAsync(nameof(NoneHandle), luisResult);

                    break;
                }
            }
            else
            {
                isIntentFound = true;
                await innerDc.BeginDialogAsync(nameof(NoneHandle), luisResult);
            }
            //await _sqlLoggerRepository.InsertBotLogAsync(innerDc.Context.Activity, taskResultNonLuis);

            return(await innerDc.EndDialogAsync(result : isIntentFound));
        }