/// <summary>
        /// Handles the receipt of a response message coming from a remote platform by resuming the workflow run and handing the
        /// messages to the relevant CAST activity implementation.
        /// </summary>
        /// <param name="request">The original request message.</param>
        /// <param name="response">The response message to process.</param>
        public async void Process(TRequest request, TResponse response)
        {
            using (new DeferredChannelMessageContext())
                using (CastService.GetCastContext())
                {
                    try
                    {
                        var run = EntityRepository.Get <WorkflowRun>(request.RunId, WorkflowRunPreload);
                        if (run == null)
                        {
                            throw new Exception(string.Format("CAST workflow activity could not resume. Workflow run ({0}) not found.", request.RunId));
                        }

                        // let the workflow or caching or whatever, catch up before officially responding to RabbitMQ
                        if (run.RunStepCounter <= request.RunStep)
                        {
                            var state = await WaitForRunStep(run.Id, request.RunStep);

                            if (state < request.RunStep)
                            {
                                throw new Exception(string.Format("CAST workflow activity could not resume. Workflow run ({0}) wasn't in step.", request.RunId));
                            }
                        }

                        var castEvent = new CastActivityResponseEvent <TRequest, TResponse>(request, response);

                        WorkflowRunner.ResumeWorkflowAsync(run, castEvent);
                    }
                    catch (Exception err)
                    {
                        EventLog.Application.WriteError("Failed to process CAST response. {0}", err);
                    }
                }
        }