Refactoring of event sourcing