/// <summary>
        /// This method is called when user enters a url in compose box from a domain that this app unfurls.
        ///
        /// Application authenticates the user to read resource and insert a card with resource information and option to review it in a meeting.
        /// </summary>
        /// <param name="turnContext">Turn context.</param>
        /// <param name="query">Query - this contains the url that user entered.</param>
        /// <param name="cancellationToken">Cancellation token.</param>
        /// <returns>ME response.</returns>
        protected async override Task <MessagingExtensionResponse> OnTeamsAppBasedLinkQueryAsync(ITurnContext <IInvokeActivity> turnContext, AppBasedLinkQuery query, CancellationToken cancellationToken)
        {
            this.logger.LogInformation($"OnTeamsAppBasedLinkQueryAsync:  {query.Url}");

            // Make sure its a valid url.
            if (!this.urlParser.IsValidResourceUrl(query.Url))
            {
                return(null);
            }

            // Make sure the user is signed-in.
            var isUserSignedIn = await turnContext.IsUserSignedInAsync(this.appSettings.GraphConnectionName, query.State, cancellationToken);

            if (!isUserSignedIn)
            {
                this.logger.LogInformation("User is not signed-in.");
                var signInUrl = await turnContext.GetOAuthSignInUrlAsync(this.appSettings.GraphConnectionName, cancellationToken);

                var signInResponse = this.GetSignInResponse(signInUrl);
                return(signInResponse);
            }

            // If the user is signed-in:
            // 1. Check if user is authorized to access the resource. (Skipped in this sample).
            // 2. Create a card with resource information/preview image and option to review it in a meeting.
            var resourceId = this.urlParser.GetResourceId(query.Url);
            var resource   = await this.resourceProvider.GetResourceAsync(resourceId);

            return(this.GetContentCardResponse(resource));
        }