put the whole write_data() tree into one transaction