Before commit: Collect data about categories, then format this, collect data about offers, then format this,  and then write all to file.
After commit: Collect all data, then format all data and write all