added write_to_database to client