changing mesaages to messages in db