public AFECustomerChangeNotificationResponse CustomerChange(AFECustomerChangeNotificationRequest request)
        {
            string postdataJson = null;
            var    retval       = new AFECustomerChangeNotificationResponse();

            try
            {
                postdataJson = JsonConvert.SerializeObject(request);
                //var postdataString = new StringContent(postdataJson, new UTF8Encoding(), "application/json");

                var response = _client.PostAsJsonAsync(_targetActionName, request).Result;
                // This extension handles json serialization of the payload etc...

                retval.Success = response.IsSuccessStatusCode;

                OnCompleted?.Invoke($"{_client.BaseAddress.AbsoluteUri}{_targetActionName}",
                                    response.ToString(), postdataJson);
            }
            catch (Exception ex)
            {
                retval.Success = false;
                OnError?.Invoke($"{_client.BaseAddress.AbsoluteUri}{_targetActionName}", ex, postdataJson);
            }

            return(retval);
        }
        private AFECustomerChangeNotificationResponse NotifyChangeToAfe(Models.ParameterModels.CustomerLoadOrMatch customer, DateTime processedDatetime, long id)
        {
            //
            var afeNotificationRequest = new AFECustomerChangeNotificationRequest
            {
                notification =
                    new AFECustomerChangeNotification
                {
                    Id                = id.ToString(), // customerId.ToString(),
                    Source            = "CWS",
                    Code              = customer.Customer.SystemSource,
                    Value             = customer.Customer.SystemId,
                    OriginatingSource = customer.Customer.SystemSource.Substring(0, 3),
                    // Timestamp = processedDatetime.ToString()
                    // AFE Endpoint supported Timestamp format
                    Timestamp = processedDatetime.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'")
                                //"2018-01-24T12:41:30.937Z"
                                // wether API Success or Fail need to update the database, so windows service will pick up and process(Windows service need to be build)
                }
            };

            // Assign local delegates to log outcome ...
            _afeWebClient.OnCompleted = LogAfeCallSuccess;
            _afeWebClient.OnError     = LogAfeCallException;

            // Call AfeWebClient to invoke the callback
            var afeNotificationResponse = _afeWebClient.CustomerChange(afeNotificationRequest);

            return(afeNotificationResponse);
        }