implement register and insert message functionality