support external state change that can fail

I changed the state mutator to be able to return a boolean - so the set state can fail
this can be used when trying to set the state in DB using optimistic locking, which can fail to set the state.