Example of how to write to CommonState from a watcher on StoredState
Improved documentation and error handling