protected virtual void OnInvokeFinished(InvokeEventArgs e)
        {
            var handler = InvokeFinished;

            if (handler != null)
            {
                handler(this, e);
            }
        }
        protected virtual void OnInvokeBegan(InvokeEventArgs e)
        {
            var handler = InvokeBegan;

            if (handler != null)
            {
                handler(this, e);
            }
        }
        public async Task <TResp> InvokeAsync <TReq, TResp>(string url, TReq req)
            where TReq : BaseReq
            where TResp : BaseResp, new()
        {
            var requestString = JsonConvert.SerializeObject(req, Formatting.Indented);

            var reqArgs = new InvokeEventArgs
            {
                Request = requestString
            };

            OnInvokeBegan(reqArgs);

            _logger.Log(requestString, Category.Info, Priority.Medium);

            var stopwatch = new Stopwatch();

            stopwatch.Start();

            TResp resp = null;

            try
            {
                resp = await _webServiceClient.Post <TReq, TResp>(url, req);
            }
            catch (Exception e)
            {
                var sb = new StringBuilder();
                sb.AppendLine(e.Message);
                sb.AppendLine();
                sb.AppendLine(e.StackTrace);

                var errorArgs = new InvokeEventArgs
                {
                    Response      = sb.ToString(),
                    OperationTime = stopwatch.ElapsedMilliseconds
                };

                _logger.Log(sb.ToString(), Category.Info, Priority.Medium);

                OnInvokeFinished(errorArgs);

                return(resp);
            }

            stopwatch.Stop();

            var responseString = JsonConvert.SerializeObject(resp, Formatting.Indented);

            var respArgs = new InvokeEventArgs
            {
                Response      = responseString,
                OperationTime = stopwatch.ElapsedMilliseconds
            };

            _logger.Log(responseString, Category.Info, Priority.Medium);
            _logger.Log($"{url}: {stopwatch.ElapsedMilliseconds} ms", Category.Info, Priority.Medium);

            OnInvokeFinished(respArgs);

            return(resp);
        }