/// <summary>
        /// Adds a new state to the state machine.
        /// </summary>
        /// <param name="state">The state.</param>
        /// <returns>The state builder.</returns>
        public IStateBuilder <TState, TTransition, TPayload> AddState(TState state)
        {
            var newState = new StateBuilder <TState, TTransition, TPayload>(state, this);

            if (true == this.states.ContainsKey(state))
            {
                throw new ArgumentException($"The state {state} is already a member of this state machine.");
            }

            this.states[state] = newState;

            return(newState);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="StateTransitionBuilder{TState, TTransition, TPayload}"/> class.
 /// </summary>
 /// <param name="transitionMessage">The transition message.</param>
 /// <param name="stateMachine">The state machine.</param>
 /// <param name="startState">The start state.</param>
 /// <param name="endState">The end state.</param>
 public StateTransitionBuilder(TTransition transitionMessage, StateMachineBuilder <TState, TTransition, TPayload> stateMachine, StateBuilder <TState, TTransition, TPayload> startState, StateBuilder <TState, TTransition, TPayload> endState)
 {
     this.Message      = transitionMessage;
     this.stateMachine = stateMachine;
     this.StartState   = startState;
     this.EndState     = endState;
 }