Ensure onFlush and postFlush events are always raised
No huge if clause
DDC-2173 - Add Test for new OnFlush or PreFlush behavior and update UPGRADE.md
Merge branch 'DDC-2173'