private Task Epilog(IDictionary <string, object> env) { var tcs = new TaskCompletionSource <object>(); _responseShouldEnd = false; _context.PushLastObjects(env, tcs); StageAsyncResult result = Interlocked.Exchange(ref _result, null); if (result != null) { result.TryComplete(); } return(tcs.Task); }