private static GenericMessage GetGenericMessage <TMessage>(TMessage payload) where TMessage : class { var msg = new GenericMessage { Message = new GenericMessage.MessageBody { CorrelationId = Guid.NewGuid(), ResponseTimeStamp = DateTime.Now, Topic = "SomeTopic" }, Event = new GenericMessage.MessageEvent { Replay = true, Rollback = true, NormalOperation = true }, Status = new GenericMessage.MessageStatus { Success = true, Error = "Nothing to see here..." } }; msg.SetPayload(payload); return(msg); }