Added the code to send responses and store them in the database.