/// <summary>
        /// This method is the default method used to process the returning message response.
        /// </summary>
        /// <typeparam name="RS">The response type.</typeparam>
        /// <param name="rType"></param>
        /// <param name="payloadRs">The incoming response payload.</param>
        /// <param name="processAsync"></param>
        /// <returns>Returns the response wrapper generic object.</returns>
        protected virtual ResponseWrapper <RS> ProcessOutgoingResponse <RS>(TaskStatus rType, TransmissionPayload payloadRs, bool processAsync)
        {
            StatisticsInternal.ActiveDecrement(payloadRs?.Extent ?? TimeSpan.Zero);

            if (processAsync)
            {
                return(new ResponseWrapper <RS>(responseCode: 202, responseMessage: "Accepted"));
            }

            try
            {
                payloadRs?.CompleteSet();

                switch (rType)
                {
                case TaskStatus.RanToCompletion:
                    try
                    {
                        //payload.Message.
                        var response = new ResponseWrapper <RS>(payloadRs);

                        if (payloadRs.Message.Blob.HasObject)
                        {
                            response.Response = (RS)payloadRs.Message.Blob.Object;
                        }
                        else if (payloadRs.Message.Blob != null)
                        {
                            response.Response = PayloadSerializer.PayloadDeserialize <RS>(payloadRs);
                        }

                        return(response);
                    }
                    catch (Exception ex)
                    {
                        StatisticsInternal.ErrorIncrement();
                        return(new ResponseWrapper <RS>(500, ex.Message));
                    }

                case TaskStatus.Canceled:
                    StatisticsInternal.ErrorIncrement();
                    return(new ResponseWrapper <RS>(408, "Time out"));

                case TaskStatus.Faulted:
                    StatisticsInternal.ErrorIncrement();
                    return(new ResponseWrapper <RS>((int)PersistenceResponse.GatewayTimeout504, "Response timeout."));

                default:
                    StatisticsInternal.ErrorIncrement();
                    return(new ResponseWrapper <RS>(500, rType.ToString()));
                }
            }
            catch (Exception ex)
            {
                Collector?.LogException("Error processing response for task status " + rType, ex);
                throw;
            }
        }