private async Task <InvokeResponse> ProcessTeamsInvokeActivityAsync(ITurnContext turnContext)
        {
            ITeamsContext teamsContext = turnContext.TurnState.Get <ITeamsContext>();

            if (teamsContext.IsRequestMessagingExtensionQuery())
            {
                return(await this.invokeActivityHandler.HandleMessagingExtensionActionAsync(new MessagingExtensionActivityAction
                {
                    MessagingExtensionQuery = teamsContext.GetMessagingExtensionQueryData(),
                    TurnContext = turnContext,
                }).ConfigureAwait(false));
            }

            if (teamsContext.IsRequestO365ConnectorCardActionQuery())
            {
                return(await this.invokeActivityHandler.HandleO365ConnectorCardActionAsync(new O365ConnectorCardActivityAction
                {
                    CardActionQuery = teamsContext.GetO365ConnectorCardActionQueryData(),
                    TurnContext = turnContext,
                }).ConfigureAwait(false));
            }

            if (teamsContext.IsRequestSigninStateVerificationQuery())
            {
                return(await this.invokeActivityHandler.HandleSigninStateVerificationActionAsync(new SigninStateVerificationActivityAction
                {
                    TurnContext = turnContext,
                    VerificationQuery = teamsContext.GetSigninStateVerificationQueryData(),
                }).ConfigureAwait(false));
            }

            return(await this.invokeActivityHandler.HandleInvokeTaskAsync(turnContext).ConfigureAwait(false));
        }
        private async Task <InvokeResponse> ProcessTeamsInvokeActivityAsync(ITurnContext turnContext)
        {
            ITeamsContext teamsContext = turnContext.TurnState.Get <ITeamsContext>();

            if (teamsContext.IsRequestO365ConnectorCardActionQuery())
            {
                return(await this.invokeActivityHandler.HandleO365ConnectorCardActionAsync(turnContext, teamsContext.GetO365ConnectorCardActionQueryData()).ConfigureAwait(false));
            }

            if (teamsContext.IsRequestSigninStateVerificationQuery())
            {
                return(await this.invokeActivityHandler.HandleSigninStateVerificationActionAsync(turnContext, teamsContext.GetSigninStateVerificationQueryData()).ConfigureAwait(false));
            }

            if (teamsContext.IsRequestFileConsentResponse())
            {
                return(await this.invokeActivityHandler.HandleFileConsentResponseAsync(turnContext, teamsContext.GetFileConsentQueryData()).ConfigureAwait(false));
            }

            if (teamsContext.IsRequestMessagingExtensionQuery())
            {
                return(await this.invokeActivityHandler.HandleMessagingExtensionQueryAsync(turnContext, teamsContext.GetMessagingExtensionQueryData()).ConfigureAwait(false));
            }

            if (teamsContext.IsRequestAppBasedLinkQuery())
            {
                return(await this.invokeActivityHandler.HandleAppBasedLinkQueryAsync(turnContext, teamsContext.GetAppBasedLinkQueryData()).ConfigureAwait(false));
            }

            if (teamsContext.IsRequestMessagingExtensionFetchTask())
            {
                return(await this.invokeActivityHandler.HandleMessagingExtensionFetchTaskAsync(turnContext, teamsContext.GetMessagingExtensionActionData()).ConfigureAwait(false));
            }

            if (teamsContext.IsRequestMessagingExtensionSubmitAction())
            {
                return(await this.invokeActivityHandler.HandleMessagingExtensionSubmitActionAsync(turnContext, teamsContext.GetMessagingExtensionActionData()).ConfigureAwait(false));
            }

            if (teamsContext.IsRequestTaskModuleFetch())
            {
                return(await this.invokeActivityHandler.HandleTaskModuleFetchAsync(turnContext, teamsContext.GetTaskModuleRequestData()).ConfigureAwait(false));
            }

            if (teamsContext.IsRequestTaskModuleSubmit())
            {
                return(await this.invokeActivityHandler.HandleTaskModuleSubmitAsync(turnContext, teamsContext.GetTaskModuleRequestData()).ConfigureAwait(false));
            }

            return(await this.invokeActivityHandler.HandleInvokeTaskAsync(turnContext).ConfigureAwait(false));
        }