further refactored topic transactions to generalize the process of generating multiple tempids and committing several related transactions