private static object UnhandledMboxResponse(
            PrefetchResponse prefetchResponse,
            ExecuteResponse executeResponse,
            MboxRequest mboxRequest,
            TraceHandler traceHandler)
        {
            if (prefetchResponse != null)
            {
                var prefetchMboxResponse = new PrefetchMboxResponse(mboxRequest.Index, mboxRequest.Name)
                {
                    Trace = traceHandler?.CurrentTrace,
                };
                prefetchResponse.Mboxes ??= new List <PrefetchMboxResponse>();
                prefetchResponse.Mboxes.Add(prefetchMboxResponse);
                return(null);
            }

            var response = new MboxResponse(mboxRequest.Index, mboxRequest.Name)
            {
                Trace = traceHandler?.CurrentTrace,
            };

            executeResponse.Mboxes ??= new List <MboxResponse>();
            executeResponse.Mboxes.Add(response);
            return(null);
        }
        private static bool HandleMboxRequest(
            PrefetchResponse prefetchResponse,
            ExecuteResponse executeResponse,
            MboxRequest mboxRequest,
            List <Option> consequenceOptions,
            List <Metric> consequenceMetrics,
            TraceHandler traceHandler)
        {
            if (prefetchResponse != null)
            {
                var prefetchMboxResponse =
                    new PrefetchMboxResponse(mboxRequest.Index, mboxRequest.Name, consequenceOptions, consequenceMetrics);
                prefetchResponse.Mboxes ??= new List <PrefetchMboxResponse>();
                prefetchResponse.Mboxes.Add(prefetchMboxResponse);
                return(true);
            }

            if (executeResponse == null)
            {
                return(false);
            }

            var mboxResponse =
                new MboxResponse(mboxRequest.Index, mboxRequest.Name, metrics: consequenceMetrics)
            {
                Options = consequenceOptions?.Select(
                    option =>
                {
                    option.EventToken = null;
                    return(option);
                })
                          .Where(option => option.Type != null || option.Content != null || option.ResponseTokens != null)
                          .ToList(),
                Trace = traceHandler?.CurrentTrace,
            };

            executeResponse.Mboxes ??= new List <MboxResponse>();
            executeResponse.Mboxes.Add(mboxResponse);
            return(true);
        }