public bool Event(string name, Dictionary <string, string> data = null)
        {
            try
            {
                EventTelemetry telemetry = new EventTelemetry(name);
                telemetry.SetOperationInfo(this);
                telemetry.MergeProperties(data.Safe());

                this.internalTelemetryClient.TrackEvent(telemetry);

                return(true);
            }
            catch (Exception ex)
            {
                DiagnosticTrace.Instance.Error("An unexpected error occured when attempting to track an event", ex, "Y6MjRLHRwUM");

                return(false);
            }
        }
        /*************************************************************************/
        public async Task WriteTelemetry(Telemetry telemetry)
        {
            await Task.Yield();

            switch (telemetry.Type)
            {
            case Telemetry.TelemetryType.Error:
            {
                var tel = new ExceptionTelemetry(telemetry.Exception);

                tel.MergeProperties(telemetry, _childrenAsJson);
                tel.Message       = telemetry.Exception.Message;
                tel.SeverityLevel = (SeverityLevel)((int)telemetry.Severity);

                SetAttributes(telemetry, tel, tel);

                _client.TrackException(tel);

                break;
            }

            case Telemetry.TelemetryType.Event:
            {
                var tel = new EventTelemetry(telemetry.Message);

                tel.MergeProperties(telemetry, _childrenAsJson);

                SetAttributes(telemetry, tel, tel);

                _client.TrackEvent(tel);

                break;
            }

            case Telemetry.TelemetryType.Metric:
            {
                var tel = new MetricTelemetry(telemetry.Message, telemetry.Value);

                tel.MergeProperties(telemetry, _childrenAsJson);

                SetAttributes(telemetry, tel, tel);

                _client.TrackMetric(tel);

                break;
            }

            case Telemetry.TelemetryType.Trace:
            {
                var tel = new TraceTelemetry(telemetry.Message, (SeverityLevel)((int)telemetry.Severity));

                tel.MergeProperties(telemetry, _childrenAsJson);

                SetAttributes(telemetry, tel, tel);

                _client.TrackTrace(tel);

                break;
            }

            case Telemetry.TelemetryType.Request:
            {
                var tel = new RequestTelemetry(telemetry.Message,
                                               telemetry.Request.StartTime,
                                               telemetry.Request.Duration,
                                               telemetry.Request.ResponseCode,
                                               telemetry.Request.Success);

                tel.MergeProperties(telemetry, _childrenAsJson);

                SetAttributes(telemetry, tel, tel);

                _client.TrackRequest(tel);

                break;
            }
            }

            _client.Flush();

            return;
        }