/// <summary>
        /// Finds the Transition with the given name and adds a loop to it. This also handles looping transitions right after multiple places (AND-join) or right before multiple places (AND-split)
        /// </summary>
        /// <param name="transitionName">The name of the transition the is looped</param>
        /// <param name="transition"></param>
        public void AddLoop(String transitionName = "", Transition transition = null)
        {
            Transition item = transition ?? FindTransition(transitionName);

            // if the activity is in the eventlog but NOT in the net
            if (item == null)
            {
                return;
            }

            Transition loop = AddTransition("(Loop)", isLoop: true);

            // before the Transition
            if (item.IncomingPlaces.Count == 1)
            {
                loop.AddOutgoingPlace(item.IncomingPlaces[0]);
            }
            else
            {
                Place      newPlace      = AddPlace();
                Transition newTransition = AddTransition();

                // redirect incoming connections
                newTransition.AddIncomingPlaces(item.IncomingPlaces);
                foreach (Place place in item.IncomingPlaces)
                {
                    place.OutgoingTransitions.Remove(item);
                }
                item.IncomingPlaces.Clear();
                // add new connections
                loop.AddOutgoingPlace(newPlace);
                newTransition.AddOutgoingPlace(newPlace);
                item.AddIncomingPlace(newPlace);
            }

            // after the Transition
            if (item.OutgoingPlaces.Count == 1)
            {
                loop.AddIncomingPlace(item.OutgoingPlaces[0]);
            }
            else
            {
                Place      newPlace      = AddPlace();
                Transition newTransition = AddTransition();

                // redirect outgoing connections
                newTransition.AddOutgoingPlaces(item.OutgoingPlaces);
                foreach (Place place in item.OutgoingPlaces)
                {
                    place.IncomingTransitions.Remove(item);
                }
                item.OutgoingPlaces.Clear();
                // add new connections
                item.AddOutgoingPlace(newPlace);
                loop.AddIncomingPlace(newPlace);
                newTransition.AddIncomingPlace(newPlace);
            }
        }
        /// <summary>
        /// Adds a place for each transition, then combines these places in the given transition.
        /// </summary>
        /// <param name="startingTransition">The starting transition</param>
        /// <param name="petriNet">The current petri net</param>
        /// <param name="endingTransition">The ending transition, if it exists already. Otherwise a new one is created></param>
        /// <returns>The transition where the places after the AND-related-events are connected.</returns>
        /// <author>Jannik Arndt</author>
        public List<Transition> EndAND(List<Transition> startingTransition, PetriNet petriNet, Transition endingTransition = null)
        {
            if (endingTransition == null)
                endingTransition = petriNet.AddTransition();

            if (_openParallelismCount.Count > 0)
                _openParallelismCount.Pop();

            var listOfClosingPlaces = new List<Place>();
            foreach (var transition in startingTransition)
            {
                var newPlace = petriNet.AddPlace();
                transition.AddOutgoingPlace(newPlace);
                listOfClosingPlaces.Add(newPlace);
            }
            endingTransition.AddIncomingPlaces(listOfClosingPlaces);
            return new List<Transition> { endingTransition };
        }