public static Options CreateOptions(this MessageContext context, string endpointname, string id, Dictionary <string, string> headers = null) { if (string.IsNullOrWhiteSpace(endpointname)) { throw new ArgumentNullException(endpointname); } if (string.IsNullOrWhiteSpace(id)) { throw new ArgumentNullException(id); } var options = new Options() { EndPointName = endpointname, Headers = context.CopyHeaders(), Id = string.IsNullOrWhiteSpace(id) ? context.Id : id, Tracks = context.Tracks, }; if (!string.IsNullOrWhiteSpace(context.ReplyToRequestId)) { options.RequestId = context.ReplyToRequestId; options.ReplyToRequestId = context.ReplyToRequestId; } if (headers != null) { foreach (var header in headers) { options.Headers.Add(header); } } return(options); }