private function handleOnStateWasSet(State $state, Payload $payload)
    {
        while ($state->hasEvent(self::ON_STATE_WAS_SET)) {
            $newState = $state->triggerEvent(self::ON_STATE_WAS_SET, $payload);
            if ($newState === null) {
                break;
            }

            $state = $this->process->state($newState);
            $this->updatePayload($state, $payload);
        }
    }