model/repository: implemented onFlush event [closes #38]