I have been trying to build my own generic state machine but I can\'t figure out a way to tie state changes with events.
For now my generic implementation looks like this