/// <summary>
        /// Ensures that two NameSpace have matching GUID, and recursively.
        /// obj is the leader for Guid. If other doesn't match obj guid, 
        ///   1. other does not have a guid, in that case, other should have the same guid as obj
        ///   2. other already has a guid. In that case, there is a mismatch between objects, and the process stops here
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="other"></param>
        public static void ensureGuidNameSpace(Generated.NameSpace obj, Generated.NameSpace other)
        {
            if ( obj == null )
            {
                if ( other != null )
                {
                    // Side effect, setup a GUID if needed for the other part (other)
                    string guid = other.Guid;
                }
                return;
            }

            if ( other == null )
            {
                if ( obj != null )
                {
                    // Side effect, setup a GUID if needed for the other part (obj)
                    string guid = obj.Guid;
                }
                return;
            }

            if ( obj.Guid != other.getGuid() )
            {
                if ( string.IsNullOrEmpty(other.getGuid()) || GuidByName && (obj.Name == other.Name) )
                {
                    // These are matching elements, copy the guid from  obj
                    other.setGuid ( obj.Guid );
                }
                else
                {
                    // Elements do not match. Stop the recursive process
                    return;
                }
            }

            ensureGuidNamable (obj, other);

            if ( obj.allNameSpaces() != null )
            {
                if ( other.allNameSpaces() != null )
                {
                    foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
                    {
                        bool found = false;

                        // Try first to assign Guid to elements which do not have a guid
                        // This helps handling duplicated in lists
                        foreach ( Generated.NameSpace otherElement in other.allNameSpaces() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) && otherElement.getGuid() == null )
                            {
                                ensureGuidNameSpace ( subElement, otherElement );
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            foreach ( Generated.NameSpace otherElement in other.allNameSpaces() )
                            {
                                if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                                {
                                    ensureGuidNameSpace ( subElement, otherElement );
                                    found = true;
                                    break;
                                }
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidNameSpace ( subElement, null );
                        }
                    }

                    foreach ( Generated.NameSpace otherElement in other.allNameSpaces() )
                    {
                        bool found = false;
                        foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidNameSpace ( null, otherElement );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
                    {
                        ensureGuidNameSpace ( subElement, null );
                    }
                }
            }
            else
            {
                if ( other.allNameSpaces() != null )
                {
                    foreach ( Generated.NameSpace otherElement in other.allNameSpaces() )
                    {
                        ensureGuidNameSpace ( null, otherElement );
                    }
                }
            }
            if ( obj.allNameSpaceRefs() != null )
            {
                if ( other.allNameSpaceRefs() != null )
                {
                    foreach ( Generated.NameSpaceRef subElement in obj.allNameSpaceRefs() )
                    {
                        bool found = false;

                        // Try first to assign Guid to elements which do not have a guid
                        // This helps handling duplicated in lists
                        foreach ( Generated.NameSpaceRef otherElement in other.allNameSpaceRefs() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) && otherElement.getGuid() == null )
                            {
                                ensureGuidNameSpaceRef ( subElement, otherElement );
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            foreach ( Generated.NameSpaceRef otherElement in other.allNameSpaceRefs() )
                            {
                                if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                                {
                                    ensureGuidNameSpaceRef ( subElement, otherElement );
                                    found = true;
                                    break;
                                }
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidNameSpaceRef ( subElement, null );
                        }
                    }

                    foreach ( Generated.NameSpaceRef otherElement in other.allNameSpaceRefs() )
                    {
                        bool found = false;
                        foreach ( Generated.NameSpaceRef subElement in obj.allNameSpaceRefs() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidNameSpaceRef ( null, otherElement );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.NameSpaceRef subElement in obj.allNameSpaceRefs() )
                    {
                        ensureGuidNameSpaceRef ( subElement, null );
                    }
                }
            }
            else
            {
                if ( other.allNameSpaceRefs() != null )
                {
                    foreach ( Generated.NameSpaceRef otherElement in other.allNameSpaceRefs() )
                    {
                        ensureGuidNameSpaceRef ( null, otherElement );
                    }
                }
            }
            if ( obj.allRanges() != null )
            {
                if ( other.allRanges() != null )
                {
                    foreach ( Generated.Range subElement in obj.allRanges() )
                    {
                        bool found = false;

                        // Try first to assign Guid to elements which do not have a guid
                        // This helps handling duplicated in lists
                        foreach ( Generated.Range otherElement in other.allRanges() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) && otherElement.getGuid() == null )
                            {
                                ensureGuidRange ( subElement, otherElement );
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            foreach ( Generated.Range otherElement in other.allRanges() )
                            {
                                if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                                {
                                    ensureGuidRange ( subElement, otherElement );
                                    found = true;
                                    break;
                                }
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidRange ( subElement, null );
                        }
                    }

                    foreach ( Generated.Range otherElement in other.allRanges() )
                    {
                        bool found = false;
                        foreach ( Generated.Range subElement in obj.allRanges() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidRange ( null, otherElement );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Range subElement in obj.allRanges() )
                    {
                        ensureGuidRange ( subElement, null );
                    }
                }
            }
            else
            {
                if ( other.allRanges() != null )
                {
                    foreach ( Generated.Range otherElement in other.allRanges() )
                    {
                        ensureGuidRange ( null, otherElement );
                    }
                }
            }
            if ( obj.allEnumerations() != null )
            {
                if ( other.allEnumerations() != null )
                {
                    foreach ( Generated.Enum subElement in obj.allEnumerations() )
                    {
                        bool found = false;

                        // Try first to assign Guid to elements which do not have a guid
                        // This helps handling duplicated in lists
                        foreach ( Generated.Enum otherElement in other.allEnumerations() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) && otherElement.getGuid() == null )
                            {
                                ensureGuidEnum ( subElement, otherElement );
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            foreach ( Generated.Enum otherElement in other.allEnumerations() )
                            {
                                if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                                {
                                    ensureGuidEnum ( subElement, otherElement );
                                    found = true;
                                    break;
                                }
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidEnum ( subElement, null );
                        }
                    }

                    foreach ( Generated.Enum otherElement in other.allEnumerations() )
                    {
                        bool found = false;
                        foreach ( Generated.Enum subElement in obj.allEnumerations() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidEnum ( null, otherElement );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Enum subElement in obj.allEnumerations() )
                    {
                        ensureGuidEnum ( subElement, null );
                    }
                }
            }
            else
            {
                if ( other.allEnumerations() != null )
                {
                    foreach ( Generated.Enum otherElement in other.allEnumerations() )
                    {
                        ensureGuidEnum ( null, otherElement );
                    }
                }
            }
            if ( obj.allStructures() != null )
            {
                if ( other.allStructures() != null )
                {
                    foreach ( Generated.Structure subElement in obj.allStructures() )
                    {
                        bool found = false;

                        // Try first to assign Guid to elements which do not have a guid
                        // This helps handling duplicated in lists
                        foreach ( Generated.Structure otherElement in other.allStructures() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) && otherElement.getGuid() == null )
                            {
                                ensureGuidStructure ( subElement, otherElement );
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            foreach ( Generated.Structure otherElement in other.allStructures() )
                            {
                                if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                                {
                                    ensureGuidStructure ( subElement, otherElement );
                                    found = true;
                                    break;
                                }
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidStructure ( subElement, null );
                        }
                    }

                    foreach ( Generated.Structure otherElement in other.allStructures() )
                    {
                        bool found = false;
                        foreach ( Generated.Structure subElement in obj.allStructures() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidStructure ( null, otherElement );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Structure subElement in obj.allStructures() )
                    {
                        ensureGuidStructure ( subElement, null );
                    }
                }
            }
            else
            {
                if ( other.allStructures() != null )
                {
                    foreach ( Generated.Structure otherElement in other.allStructures() )
                    {
                        ensureGuidStructure ( null, otherElement );
                    }
                }
            }
            if ( obj.allCollections() != null )
            {
                if ( other.allCollections() != null )
                {
                    foreach ( Generated.Collection subElement in obj.allCollections() )
                    {
                        bool found = false;

                        // Try first to assign Guid to elements which do not have a guid
                        // This helps handling duplicated in lists
                        foreach ( Generated.Collection otherElement in other.allCollections() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) && otherElement.getGuid() == null )
                            {
                                ensureGuidCollection ( subElement, otherElement );
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            foreach ( Generated.Collection otherElement in other.allCollections() )
                            {
                                if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                                {
                                    ensureGuidCollection ( subElement, otherElement );
                                    found = true;
                                    break;
                                }
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidCollection ( subElement, null );
                        }
                    }

                    foreach ( Generated.Collection otherElement in other.allCollections() )
                    {
                        bool found = false;
                        foreach ( Generated.Collection subElement in obj.allCollections() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidCollection ( null, otherElement );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Collection subElement in obj.allCollections() )
                    {
                        ensureGuidCollection ( subElement, null );
                    }
                }
            }
            else
            {
                if ( other.allCollections() != null )
                {
                    foreach ( Generated.Collection otherElement in other.allCollections() )
                    {
                        ensureGuidCollection ( null, otherElement );
                    }
                }
            }
            if ( obj.allStateMachines() != null )
            {
                if ( other.allStateMachines() != null )
                {
                    foreach ( Generated.StateMachine subElement in obj.allStateMachines() )
                    {
                        bool found = false;

                        // Try first to assign Guid to elements which do not have a guid
                        // This helps handling duplicated in lists
                        foreach ( Generated.StateMachine otherElement in other.allStateMachines() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) && otherElement.getGuid() == null )
                            {
                                ensureGuidStateMachine ( subElement, otherElement );
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            foreach ( Generated.StateMachine otherElement in other.allStateMachines() )
                            {
                                if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                                {
                                    ensureGuidStateMachine ( subElement, otherElement );
                                    found = true;
                                    break;
                                }
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidStateMachine ( subElement, null );
                        }
                    }

                    foreach ( Generated.StateMachine otherElement in other.allStateMachines() )
                    {
                        bool found = false;
                        foreach ( Generated.StateMachine subElement in obj.allStateMachines() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidStateMachine ( null, otherElement );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.StateMachine subElement in obj.allStateMachines() )
                    {
                        ensureGuidStateMachine ( subElement, null );
                    }
                }
            }
            else
            {
                if ( other.allStateMachines() != null )
                {
                    foreach ( Generated.StateMachine otherElement in other.allStateMachines() )
                    {
                        ensureGuidStateMachine ( null, otherElement );
                    }
                }
            }
            if ( obj.allFunctions() != null )
            {
                if ( other.allFunctions() != null )
                {
                    foreach ( Generated.Function subElement in obj.allFunctions() )
                    {
                        bool found = false;

                        // Try first to assign Guid to elements which do not have a guid
                        // This helps handling duplicated in lists
                        foreach ( Generated.Function otherElement in other.allFunctions() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) && otherElement.getGuid() == null )
                            {
                                ensureGuidFunction ( subElement, otherElement );
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            foreach ( Generated.Function otherElement in other.allFunctions() )
                            {
                                if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                                {
                                    ensureGuidFunction ( subElement, otherElement );
                                    found = true;
                                    break;
                                }
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidFunction ( subElement, null );
                        }
                    }

                    foreach ( Generated.Function otherElement in other.allFunctions() )
                    {
                        bool found = false;
                        foreach ( Generated.Function subElement in obj.allFunctions() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidFunction ( null, otherElement );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Function subElement in obj.allFunctions() )
                    {
                        ensureGuidFunction ( subElement, null );
                    }
                }
            }
            else
            {
                if ( other.allFunctions() != null )
                {
                    foreach ( Generated.Function otherElement in other.allFunctions() )
                    {
                        ensureGuidFunction ( null, otherElement );
                    }
                }
            }
            if ( obj.allProcedures() != null )
            {
                if ( other.allProcedures() != null )
                {
                    foreach ( Generated.Procedure subElement in obj.allProcedures() )
                    {
                        bool found = false;

                        // Try first to assign Guid to elements which do not have a guid
                        // This helps handling duplicated in lists
                        foreach ( Generated.Procedure otherElement in other.allProcedures() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) && otherElement.getGuid() == null )
                            {
                                ensureGuidProcedure ( subElement, otherElement );
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            foreach ( Generated.Procedure otherElement in other.allProcedures() )
                            {
                                if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                                {
                                    ensureGuidProcedure ( subElement, otherElement );
                                    found = true;
                                    break;
                                }
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidProcedure ( subElement, null );
                        }
                    }

                    foreach ( Generated.Procedure otherElement in other.allProcedures() )
                    {
                        bool found = false;
                        foreach ( Generated.Procedure subElement in obj.allProcedures() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidProcedure ( null, otherElement );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Procedure subElement in obj.allProcedures() )
                    {
                        ensureGuidProcedure ( subElement, null );
                    }
                }
            }
            else
            {
                if ( other.allProcedures() != null )
                {
                    foreach ( Generated.Procedure otherElement in other.allProcedures() )
                    {
                        ensureGuidProcedure ( null, otherElement );
                    }
                }
            }
            if ( obj.allVariables() != null )
            {
                if ( other.allVariables() != null )
                {
                    foreach ( Generated.Variable subElement in obj.allVariables() )
                    {
                        bool found = false;

                        // Try first to assign Guid to elements which do not have a guid
                        // This helps handling duplicated in lists
                        foreach ( Generated.Variable otherElement in other.allVariables() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) && otherElement.getGuid() == null )
                            {
                                ensureGuidVariable ( subElement, otherElement );
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            foreach ( Generated.Variable otherElement in other.allVariables() )
                            {
                                if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                                {
                                    ensureGuidVariable ( subElement, otherElement );
                                    found = true;
                                    break;
                                }
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidVariable ( subElement, null );
                        }
                    }

                    foreach ( Generated.Variable otherElement in other.allVariables() )
                    {
                        bool found = false;
                        foreach ( Generated.Variable subElement in obj.allVariables() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidVariable ( null, otherElement );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Variable subElement in obj.allVariables() )
                    {
                        ensureGuidVariable ( subElement, null );
                    }
                }
            }
            else
            {
                if ( other.allVariables() != null )
                {
                    foreach ( Generated.Variable otherElement in other.allVariables() )
                    {
                        ensureGuidVariable ( null, otherElement );
                    }
                }
            }
            if ( obj.allRules() != null )
            {
                if ( other.allRules() != null )
                {
                    foreach ( Generated.Rule subElement in obj.allRules() )
                    {
                        bool found = false;

                        // Try first to assign Guid to elements which do not have a guid
                        // This helps handling duplicated in lists
                        foreach ( Generated.Rule otherElement in other.allRules() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) && otherElement.getGuid() == null )
                            {
                                ensureGuidRule ( subElement, otherElement );
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            foreach ( Generated.Rule otherElement in other.allRules() )
                            {
                                if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                                {
                                    ensureGuidRule ( subElement, otherElement );
                                    found = true;
                                    break;
                                }
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidRule ( subElement, null );
                        }
                    }

                    foreach ( Generated.Rule otherElement in other.allRules() )
                    {
                        bool found = false;
                        foreach ( Generated.Rule subElement in obj.allRules() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidRule ( null, otherElement );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Rule subElement in obj.allRules() )
                    {
                        ensureGuidRule ( subElement, null );
                    }
                }
            }
            else
            {
                if ( other.allRules() != null )
                {
                    foreach ( Generated.Rule otherElement in other.allRules() )
                    {
                        ensureGuidRule ( null, otherElement );
                    }
                }
            }
        }
        /// <summary>
        /// Compares two Structure and annotates the differences on the first one
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="other"></param>
        public static void compareStructure(Generated.Structure obj, Generated.Structure other, VersionDiff diff)
        {
            if ( other == null )
            {
                diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) );
                return;
            }

            compareType (obj, other, diff);

            if ( obj.allElements() != null )
            {
                if ( other.allElements() != null )
                {
                    foreach ( Generated.StructureElement subElement in obj.allElements() )
                    {
                        bool compared = false;
                        foreach ( Generated.StructureElement otherElement in other.allElements() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareStructureElement ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Elements", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.StructureElement otherElement in other.allElements() )
                    {
                        bool found = false;
                        foreach ( Generated.StructureElement subElement in obj.allElements() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Elements", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.StructureElement subElement in obj.allElements() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Elements", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allElements() != null )
                {
                    foreach ( Generated.StructureElement otherElement in other.allElements() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Elements", otherElement.Name) );
                    }
                }
            }
            if ( obj.allProcedures() != null )
            {
                if ( other.allProcedures() != null )
                {
                    foreach ( Generated.Procedure subElement in obj.allProcedures() )
                    {
                        bool compared = false;
                        foreach ( Generated.Procedure otherElement in other.allProcedures() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareProcedure ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Procedures", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.Procedure otherElement in other.allProcedures() )
                    {
                        bool found = false;
                        foreach ( Generated.Procedure subElement in obj.allProcedures() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Procedures", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Procedure subElement in obj.allProcedures() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Procedures", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allProcedures() != null )
                {
                    foreach ( Generated.Procedure otherElement in other.allProcedures() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Procedures", otherElement.Name) );
                    }
                }
            }
            if ( obj.allStateMachines() != null )
            {
                if ( other.allStateMachines() != null )
                {
                    foreach ( Generated.StateMachine subElement in obj.allStateMachines() )
                    {
                        bool compared = false;
                        foreach ( Generated.StateMachine otherElement in other.allStateMachines() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareStateMachine ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "StateMachines", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.StateMachine otherElement in other.allStateMachines() )
                    {
                        bool found = false;
                        foreach ( Generated.StateMachine subElement in obj.allStateMachines() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "StateMachines", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.StateMachine subElement in obj.allStateMachines() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "StateMachines", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allStateMachines() != null )
                {
                    foreach ( Generated.StateMachine otherElement in other.allStateMachines() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "StateMachines", otherElement.Name) );
                    }
                }
            }
            if ( obj.allRules() != null )
            {
                if ( other.allRules() != null )
                {
                    foreach ( Generated.Rule subElement in obj.allRules() )
                    {
                        bool compared = false;
                        foreach ( Generated.Rule otherElement in other.allRules() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareRule ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Rules", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.Rule otherElement in other.allRules() )
                    {
                        bool found = false;
                        foreach ( Generated.Rule subElement in obj.allRules() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Rules", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Rule subElement in obj.allRules() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Rules", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allRules() != null )
                {
                    foreach ( Generated.Rule otherElement in other.allRules() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Rules", otherElement.Name) );
                    }
                }
            }
            if ( obj.allInterfaces() != null )
            {
                if ( other.allInterfaces() != null )
                {
                    foreach ( Generated.StructureRef subElement in obj.allInterfaces() )
                    {
                        bool compared = false;
                        foreach ( Generated.StructureRef otherElement in other.allInterfaces() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareStructureRef ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Interfaces", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.StructureRef otherElement in other.allInterfaces() )
                    {
                        bool found = false;
                        foreach ( Generated.StructureRef subElement in obj.allInterfaces() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Interfaces", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.StructureRef subElement in obj.allInterfaces() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Interfaces", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allInterfaces() != null )
                {
                    foreach ( Generated.StructureRef otherElement in other.allInterfaces() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Interfaces", otherElement.Name) );
                    }
                }
            }
            if ( obj.getIsAbstract() != other.getIsAbstract() )
            {
                diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "IsAbstract", other.getIsAbstract().ToString(), obj.getIsAbstract().ToString()) );
            }
        }
        /// <summary>
        /// Searches a specific string in Structure and updates the list 
        /// of model element with all the elements in which that string is found
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="obj">The string to search for</param>
        /// <param name="occurences">The list of model elements which hold the searched string</param>
        public static void searchStructure(Generated.Structure obj, string searchString, List<ModelElement> occurences)
        {
            searchType (obj, searchString, occurences);

            if ( obj.allElements() != null )
            {
                foreach ( Generated.StructureElement subElement in obj.allElements() )
                {
                    searchStructureElement ( subElement, searchString, occurences );
                }
            }
            if ( obj.allProcedures() != null )
            {
                foreach ( Generated.Procedure subElement in obj.allProcedures() )
                {
                    searchProcedure ( subElement, searchString, occurences );
                }
            }
            if ( obj.allStateMachines() != null )
            {
                foreach ( Generated.StateMachine subElement in obj.allStateMachines() )
                {
                    searchStateMachine ( subElement, searchString, occurences );
                }
            }
            if ( obj.allRules() != null )
            {
                foreach ( Generated.Rule subElement in obj.allRules() )
                {
                    searchRule ( subElement, searchString, occurences );
                }
            }
            if ( obj.allInterfaces() != null )
            {
                foreach ( Generated.StructureRef subElement in obj.allInterfaces() )
                {
                    searchStructureRef ( subElement, searchString, occurences );
                }
            }
        }
        /// <summary>
        /// Compares two NameSpace and annotates the differences on the first one
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="other"></param>
        public static void compareNameSpace(Generated.NameSpace obj, Generated.NameSpace other, VersionDiff diff)
        {
            if ( other == null )
            {
                diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) );
                return;
            }

            compareNamable (obj, other, diff);

            if ( obj.allNameSpaces() != null )
            {
                if ( other.allNameSpaces() != null )
                {
                    foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
                    {
                        bool compared = false;
                        foreach ( Generated.NameSpace otherElement in other.allNameSpaces() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareNameSpace ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "NameSpaces", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.NameSpace otherElement in other.allNameSpaces() )
                    {
                        bool found = false;
                        foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "NameSpaces", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "NameSpaces", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allNameSpaces() != null )
                {
                    foreach ( Generated.NameSpace otherElement in other.allNameSpaces() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "NameSpaces", otherElement.Name) );
                    }
                }
            }
            if ( obj.allNameSpaceRefs() != null )
            {
                if ( other.allNameSpaceRefs() != null )
                {
                    foreach ( Generated.NameSpaceRef subElement in obj.allNameSpaceRefs() )
                    {
                        bool compared = false;
                        foreach ( Generated.NameSpaceRef otherElement in other.allNameSpaceRefs() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareNameSpaceRef ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "NameSpaceRefs", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.NameSpaceRef otherElement in other.allNameSpaceRefs() )
                    {
                        bool found = false;
                        foreach ( Generated.NameSpaceRef subElement in obj.allNameSpaceRefs() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "NameSpaceRefs", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.NameSpaceRef subElement in obj.allNameSpaceRefs() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "NameSpaceRefs", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allNameSpaceRefs() != null )
                {
                    foreach ( Generated.NameSpaceRef otherElement in other.allNameSpaceRefs() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "NameSpaceRefs", otherElement.Name) );
                    }
                }
            }
            if ( obj.allRanges() != null )
            {
                if ( other.allRanges() != null )
                {
                    foreach ( Generated.Range subElement in obj.allRanges() )
                    {
                        bool compared = false;
                        foreach ( Generated.Range otherElement in other.allRanges() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareRange ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Ranges", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.Range otherElement in other.allRanges() )
                    {
                        bool found = false;
                        foreach ( Generated.Range subElement in obj.allRanges() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Ranges", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Range subElement in obj.allRanges() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Ranges", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allRanges() != null )
                {
                    foreach ( Generated.Range otherElement in other.allRanges() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Ranges", otherElement.Name) );
                    }
                }
            }
            if ( obj.allEnumerations() != null )
            {
                if ( other.allEnumerations() != null )
                {
                    foreach ( Generated.Enum subElement in obj.allEnumerations() )
                    {
                        bool compared = false;
                        foreach ( Generated.Enum otherElement in other.allEnumerations() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareEnum ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Enumerations", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.Enum otherElement in other.allEnumerations() )
                    {
                        bool found = false;
                        foreach ( Generated.Enum subElement in obj.allEnumerations() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Enumerations", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Enum subElement in obj.allEnumerations() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Enumerations", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allEnumerations() != null )
                {
                    foreach ( Generated.Enum otherElement in other.allEnumerations() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Enumerations", otherElement.Name) );
                    }
                }
            }
            if ( obj.allStructures() != null )
            {
                if ( other.allStructures() != null )
                {
                    foreach ( Generated.Structure subElement in obj.allStructures() )
                    {
                        bool compared = false;
                        foreach ( Generated.Structure otherElement in other.allStructures() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareStructure ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Structures", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.Structure otherElement in other.allStructures() )
                    {
                        bool found = false;
                        foreach ( Generated.Structure subElement in obj.allStructures() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Structures", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Structure subElement in obj.allStructures() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Structures", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allStructures() != null )
                {
                    foreach ( Generated.Structure otherElement in other.allStructures() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Structures", otherElement.Name) );
                    }
                }
            }
            if ( obj.allCollections() != null )
            {
                if ( other.allCollections() != null )
                {
                    foreach ( Generated.Collection subElement in obj.allCollections() )
                    {
                        bool compared = false;
                        foreach ( Generated.Collection otherElement in other.allCollections() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareCollection ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Collections", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.Collection otherElement in other.allCollections() )
                    {
                        bool found = false;
                        foreach ( Generated.Collection subElement in obj.allCollections() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Collections", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Collection subElement in obj.allCollections() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Collections", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allCollections() != null )
                {
                    foreach ( Generated.Collection otherElement in other.allCollections() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Collections", otherElement.Name) );
                    }
                }
            }
            if ( obj.allStateMachines() != null )
            {
                if ( other.allStateMachines() != null )
                {
                    foreach ( Generated.StateMachine subElement in obj.allStateMachines() )
                    {
                        bool compared = false;
                        foreach ( Generated.StateMachine otherElement in other.allStateMachines() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareStateMachine ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "StateMachines", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.StateMachine otherElement in other.allStateMachines() )
                    {
                        bool found = false;
                        foreach ( Generated.StateMachine subElement in obj.allStateMachines() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "StateMachines", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.StateMachine subElement in obj.allStateMachines() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "StateMachines", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allStateMachines() != null )
                {
                    foreach ( Generated.StateMachine otherElement in other.allStateMachines() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "StateMachines", otherElement.Name) );
                    }
                }
            }
            if ( obj.allFunctions() != null )
            {
                if ( other.allFunctions() != null )
                {
                    foreach ( Generated.Function subElement in obj.allFunctions() )
                    {
                        bool compared = false;
                        foreach ( Generated.Function otherElement in other.allFunctions() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareFunction ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Functions", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.Function otherElement in other.allFunctions() )
                    {
                        bool found = false;
                        foreach ( Generated.Function subElement in obj.allFunctions() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Functions", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Function subElement in obj.allFunctions() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Functions", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allFunctions() != null )
                {
                    foreach ( Generated.Function otherElement in other.allFunctions() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Functions", otherElement.Name) );
                    }
                }
            }
            if ( obj.allProcedures() != null )
            {
                if ( other.allProcedures() != null )
                {
                    foreach ( Generated.Procedure subElement in obj.allProcedures() )
                    {
                        bool compared = false;
                        foreach ( Generated.Procedure otherElement in other.allProcedures() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareProcedure ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Procedures", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.Procedure otherElement in other.allProcedures() )
                    {
                        bool found = false;
                        foreach ( Generated.Procedure subElement in obj.allProcedures() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Procedures", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Procedure subElement in obj.allProcedures() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Procedures", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allProcedures() != null )
                {
                    foreach ( Generated.Procedure otherElement in other.allProcedures() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Procedures", otherElement.Name) );
                    }
                }
            }
            if ( obj.allVariables() != null )
            {
                if ( other.allVariables() != null )
                {
                    foreach ( Generated.Variable subElement in obj.allVariables() )
                    {
                        bool compared = false;
                        foreach ( Generated.Variable otherElement in other.allVariables() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareVariable ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Variables", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.Variable otherElement in other.allVariables() )
                    {
                        bool found = false;
                        foreach ( Generated.Variable subElement in obj.allVariables() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Variables", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Variable subElement in obj.allVariables() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Variables", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allVariables() != null )
                {
                    foreach ( Generated.Variable otherElement in other.allVariables() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Variables", otherElement.Name) );
                    }
                }
            }
            if ( obj.allRules() != null )
            {
                if ( other.allRules() != null )
                {
                    foreach ( Generated.Rule subElement in obj.allRules() )
                    {
                        bool compared = false;
                        foreach ( Generated.Rule otherElement in other.allRules() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareRule ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Rules", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.Rule otherElement in other.allRules() )
                    {
                        bool found = false;
                        foreach ( Generated.Rule subElement in obj.allRules() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Rules", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Rule subElement in obj.allRules() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Rules", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allRules() != null )
                {
                    foreach ( Generated.Rule otherElement in other.allRules() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Rules", otherElement.Name) );
                    }
                }
            }
            if ( !CompareUtil.canonicalStringEquality(obj.getComment(), other.getComment()) )
            {
                diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Comment", other.getComment(), obj.getComment()) );
            }
        }
        /// <summary>
        /// Searches a specific string in NameSpace and updates the list 
        /// of model element with all the elements in which that string is found
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="obj">The string to search for</param>
        /// <param name="occurences">The list of model elements which hold the searched string</param>
        public static void searchNameSpace(Generated.NameSpace obj, string searchString, List<ModelElement> occurences)
        {
            searchNamable (obj, searchString, occurences);

            if ( obj.allNameSpaces() != null )
            {
                foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
                {
                    searchNameSpace ( subElement, searchString, occurences );
                }
            }
            if ( obj.allNameSpaceRefs() != null )
            {
                foreach ( Generated.NameSpaceRef subElement in obj.allNameSpaceRefs() )
                {
                    searchNameSpaceRef ( subElement, searchString, occurences );
                }
            }
            if ( obj.allRanges() != null )
            {
                foreach ( Generated.Range subElement in obj.allRanges() )
                {
                    searchRange ( subElement, searchString, occurences );
                }
            }
            if ( obj.allEnumerations() != null )
            {
                foreach ( Generated.Enum subElement in obj.allEnumerations() )
                {
                    searchEnum ( subElement, searchString, occurences );
                }
            }
            if ( obj.allStructures() != null )
            {
                foreach ( Generated.Structure subElement in obj.allStructures() )
                {
                    searchStructure ( subElement, searchString, occurences );
                }
            }
            if ( obj.allCollections() != null )
            {
                foreach ( Generated.Collection subElement in obj.allCollections() )
                {
                    searchCollection ( subElement, searchString, occurences );
                }
            }
            if ( obj.allStateMachines() != null )
            {
                foreach ( Generated.StateMachine subElement in obj.allStateMachines() )
                {
                    searchStateMachine ( subElement, searchString, occurences );
                }
            }
            if ( obj.allFunctions() != null )
            {
                foreach ( Generated.Function subElement in obj.allFunctions() )
                {
                    searchFunction ( subElement, searchString, occurences );
                }
            }
            if ( obj.allProcedures() != null )
            {
                foreach ( Generated.Procedure subElement in obj.allProcedures() )
                {
                    searchProcedure ( subElement, searchString, occurences );
                }
            }
            if ( obj.allVariables() != null )
            {
                foreach ( Generated.Variable subElement in obj.allVariables() )
                {
                    searchVariable ( subElement, searchString, occurences );
                }
            }
            if ( obj.allRules() != null )
            {
                foreach ( Generated.Rule subElement in obj.allRules() )
                {
                    searchRule ( subElement, searchString, occurences );
                }
            }
            if ( obj.getComment() != null && obj.getComment().Contains (searchString) )
            {
                occurences.Add ( obj );
            }
        }