public HashSet <BpmnObject> RequiredInputObjects(BpmnActivity activity)
            {
                // select all input object names for activity
                var y = Models.Where(x => x.activityName.Equals(activity.Name))
                        .Select(x => x.objectName)
                        .ToList();

                // lookup all BpmnObjects
                return(new HashSet <BpmnObject>(ObjectHelper.Instance()
                                                .GetAllObjects()
                                                .Where(x => y.Contains(x.Name))
                                                .ToList()));
            }
        /// <summary>
        ///     Parses a *valid* process into a tree representation
        /// </summary>
        /// <param name="s">process string</param>
        /// <returns>genome</returns>
        public static BpmGenome ParseBpmGenome(this string s)
        {
            if (string.IsNullOrEmpty(s))
            {
                return(null);
            }

            Debug.WriteLine("Parsing now the following string: " + s);

            var     genome = new BpmGenome();
            BpmGene parent = null;

            s = s.Replace(" ", "");

            var index = 0;

            while (s.Length > 0)
            {
                if (s.StartsWith("<PI;"))
                {
                    s = s.Substring(4);
                }
                else if (s.StartsWith(";PO>"))
                {
                    s = s.Substring(4);
                }
                else if (s.StartsWith("AND("))
                {
                    s = s.Substring(4);

                    var and = new BpmnAnd(index, parent);
                    parent?.Children.Add(and);

                    if (genome.RootGene == null)
                    {
                        genome.RootGene = and;
                    }

                    parent = and;
                    index++;
                }
                else if (s.StartsWith("SEQ("))
                {
                    s = s.Substring(4);
                    var seq = new BpmnSeq(index, parent);

                    // Only necessary if genome is one seq
                    if (parent == null)
                    {
                        genome.RootGene = seq;
                    }
                    else
                    {
                        parent.Children.Add(seq);
                    }

                    parent = seq;
                    index++;
                }
                else if (s.StartsWith("XOR("))
                {
                    s = s.Substring(4);
                    var decision = s.Substring(0, s.IndexOf(";"));
                    s = s.Substring(decision.Length);

                    decision = decision.Substring(2);
                    decision = decision.Substring(0, decision.Length - 1);

                    var decisionId    = decision.Split(',')[0];
                    var decisionValue = decision.Split(',')[1];

                    var probability = DataHelper.ActivityAttributeHelper.Instance()
                                      .GetDecisionProbability(decisionId,
                                                              decisionValue);

                    var xor = new BpmnXor(index, parent, decisionId, decisionValue, probability);

                    // Only necessary if genome is one xor
                    if (parent == null)
                    {
                        genome.RootGene = xor;
                    }
                    else
                    {
                        parent.Children.Add(xor);
                    }

                    parent = xor;
                    index++;
                }
                else if (s.StartsWith(";"))
                {
                    s = s.Substring(1);
                }
                else if (s.StartsWith(")"))
                {
                    parent = parent.Parent;
                    s      = s.Substring(1);
                }
                else
                {
                    char[] seperators = { ';', ')' };
                    var    name       = s.Substring(0, s.IndexOfAny(seperators));
                    s = s.Substring(s.IndexOfAny(seperators));

                    var activity = new BpmnActivity(index, parent, name);

                    // Only necessary if genome is one activity
                    if (parent == null)
                    {
                        genome.RootGene = activity;
                    }
                    else
                    {
                        parent.Children.Add(activity);
                    }

                    index++;
                }
            }

            if (parent != null)
            {
                throw new Exception("Illegal input string");
            }

            return(genome);
        }