public static MessageDto ToMessageResponse(this Db.Entities.Message entity)
 {
     return(new MessageDto()
     {
         Id = entity.Id.ToString(),
         TextMessage = entity.TextMessage,
         IdRecipient = entity.IdRecipient,
         IdSender = entity.IdSender,
         DateTime = entity.DateAndTime
     });
 }
        public static Db.Entities.Message ToMessage(this MessageDto entity)
        {
            var message = new Db.Entities.Message()
            {
                TextMessage = entity.TextMessage,
                IdRecipient = entity.IdRecipient,
                IdSender    = entity.IdSender,
                DateAndTime = entity.DateTime,
            };

            if (entity.Id != null)
            {
                message.Id = new Guid(entity.Id);
            }

            return(message);
        }