public void SetState(T state) { Argument.NotNull(state); if (!_states.Contains(state)) { throw new ArgumentException("Cannot set a state to a state not within the controller."); } var oldState = CurrentState; CurrentState = state; if (oldState != CurrentState) { OnStateChange.SafeInvoke(oldState, CurrentState); } }