public List <LogicalMessage> CreateMultiple(IEnumerable <object> messages)
        {
            if (messages == null)
            {
                return(new List <LogicalMessage>());
            }

            return(messages.Select(m =>
            {
                var messageType = MessageMapper.GetMappedTypeFor(m.GetType());
                var headers = GetMessageHeaders(m);

                return new LogicalMessage(MessageMetadataRegistry.GetMessageDefinition(messageType), m, headers, this);
            }).ToList());
        }
        public LogicalMessage Create(Type messageType, object message, Dictionary <string, string> headers)
        {
            var realMessageType = MessageMapper.GetMappedTypeFor(messageType);

            return(new LogicalMessage(MessageMetadataRegistry.GetMessageDefinition(realMessageType), message, headers, this));
        }