private async Task SetCurrentStateFromTransition(ITransition transition)
        {
            _ = transition ?? throw new ArgumentNullException(nameof(transition));

            IState newState = await transition.GetState(this).ConfigureAwait(false) ?? throw new NullReferenceException("Transition returned NULL state.");

            IState oldState = CurrentState;

            CurrentState = newState;
            if (oldState != null)
            {
                await oldState.OnExited(newState).ConfigureAwait(false);
            }
            await newState.OnEntered(oldState).ConfigureAwait(false);
        }