private async Task HandleReentryTriggerAsync(object[] args, StateRepresentation representativeState, Transition transition)
        {
            StateRepresentation representation;

            transition = await representativeState.ExitAsync(transition);

            var newRepresentation = GetRepresentation(transition.Destination);

            if (!transition.Source.Equals(transition.Destination))
            {
                // Then Exit the final superstate
                transition = new Transition(transition.Destination, transition.Destination, transition.Trigger, args);
                await newRepresentation.ExitAsync(transition);

                await _onTransitionedEvent.InvokeAsync(transition);

                representation = await EnterStateAsync(newRepresentation, transition, args);

                await _onTransitionCompletedEvent.InvokeAsync(transition);
            }
            else
            {
                await _onTransitionedEvent.InvokeAsync(transition);

                representation = await EnterStateAsync(newRepresentation, transition, args);

                await _onTransitionCompletedEvent.InvokeAsync(transition);
            }
            State = representation.UnderlyingState;
        }
        private async Task HandleTransitioningTriggerAsync(object[] args, StateRepresentation representativeState, Transition transition)
        {
            transition = await representativeState.ExitAsync(transition);

            State = transition.Destination;
            var newRepresentation = GetRepresentation(transition.Destination);

            //Alert all listeners of state transition
            await _onTransitionedEvent.InvokeAsync(transition);

            var representation = await EnterStateAsync(newRepresentation, transition, args);

            // Check if state has changed by entering new state (by fireing triggers in OnEntry or such)
            if (!representation.UnderlyingState.Equals(State))
            {
                // The state has been changed after entering the state, must update current state to new one
                State = representation.UnderlyingState;
            }

            await _onTransitionCompletedEvent.InvokeAsync(new Transition(transition.Source, State, transition.Trigger, transition.Parameters));
        }