public async Task <bool?> Handle(Update update, OperationTelemetry telemetry, CancellationToken cancellationToken = default)
        {
            var inlineQuery = update.InlineQuery;

            telemetry.Properties["uid"]      = inlineQuery.From?.Id.ToString();
            telemetry.Properties["username"] = inlineQuery.From?.Username;
            telemetry.Properties["query"]    = inlineQuery.Query;
            return(await HandlerExtentions <bool?> .Handle(myInlineQueryHandlers, inlineQuery, new object(), cancellationToken).ConfigureAwait(false));
        }
        public async Task <bool?> Handle(Update update, OperationTelemetry telemetry, CancellationToken cancellationToken = default)
        {
            var chosenInlineResult = update.ChosenInlineResult;

            telemetry.Properties["uid"]      = chosenInlineResult.From?.Id.ToString();
            telemetry.Properties["username"] = chosenInlineResult.From?.Username;
            telemetry.Properties["query"]    = chosenInlineResult.Query;
            telemetry.Properties["result"]   = chosenInlineResult.ResultId;
            return(await HandlerExtentions <bool?> .Handle(myChosenInlineResultHandlers, chosenInlineResult, new object(), cancellationToken).ConfigureAwait(false));
        }
        public async Task <IActionResult> Update([CanBeNull, FromBody] Update update, CancellationToken cancellationToken = default)
        {
            var operation = myTelemetryClient.StartOperation(new DependencyTelemetry(myTelemetryTypeName ?? GetType().Namespace, Request.Host.ToString(), update?.Type.ToString(), update?.Id.ToString()));

            try
            {
                if (update == null)
                {
                    foreach (var errorEntry in ModelState)
                    {
                        operation.Telemetry.Properties[$"ModelState.{errorEntry.Key}"] = errorEntry.Value.AttemptedValue;
                        var errors = errorEntry.Value.Errors;
                        for (var i = 0; i < errors.Count; i++)
                        {
                            operation.Telemetry.Properties[$"ModelState.{errorEntry.Key}.{i}"] = errors[i].ErrorMessage;
                            if (errors[i].Exception is Exception exception)
                            {
                                myTelemetryClient.TrackException(exception, new Dictionary <string, string> {
                                    { errorEntry.Key, errorEntry.Value.AttemptedValue }
                                });
                            }
                        }
                    }
                    throw new ArgumentNullException(nameof(update));
                }

                if (await HandlerExtentions <bool?> .Handle(myUpdateHandlers.Bind(update), update, (OperationTelemetry)operation.Telemetry, cancellationToken).ConfigureAwait(false) is bool result)
                {
                    operation.Telemetry.Success = result;
                    return(Ok());
                }

                operation.Telemetry.Success = true;
                return(Ok() /* TODO: not handled */);
            }
            catch (OperationCanceledException operationCanceledException) when(!cancellationToken.IsCancellationRequested)
            {
                operation.Telemetry.Success = false;
                myTelemetryClient.TrackException(new ExceptionTelemetry(operationCanceledException)
                {
                    SeverityLevel = SeverityLevel.Warning
                });
                return(Ok());
            }
            catch (Exception ex)
            {
                operation.Telemetry.Success = false;
                myTelemetryClient.TrackException(ex);
                return(Ok());
            }
            finally
            {
                operation.Dispose();
            }
        }