internal LocalCompiledPolicySetCache(LocalCompiledPolicySetCache existing)
		{
			m_target = existing.m_target;
			m_channel = existing.m_channel;
			m_content = existing.m_content;
			m_objects = existing.m_objects;

			foreach (LocalPolicyLanguageTableCache existingLang in existing.Languages)
			{
				LocalPolicyLanguageTableCache newLang = new LocalPolicyLanguageTableCache(existingLang);
                newLang.ObjectModified += new ObjectModifiedEventHandler(OnObjectModified);

				m_languages.Add(newLang);
			}
		}
		internal LocalPolicySetVersionCache(LocalPolicySetVersionCache existing, string version, bool latest, PolicySetVersionStatus status)
		{
			m_name = existing.m_name;
			m_version = version;
			m_content = existing.Content;
			m_Status = status;


            if (existing.MasterCatalogue != null)
            {
                LocalPolicyCatalogueCache master = new LocalPolicyCatalogueCache(existing.MasterCatalogue as LocalPolicyCatalogueCache);
                master.ObjectModified += new ObjectModifiedEventHandler(OnObjectModified);
                m_masterCatalogue = master;
            }


			if (existing.m_refCatalogues != null)
			{
				foreach (LocalPolicyCatalogueCache existingCat in existing.m_refCatalogues)
				{
					LocalPolicyCatalogueCache newCat = new LocalPolicyCatalogueCache(existingCat);
                    newCat.ObjectModified += new ObjectModifiedEventHandler(OnObjectModified);
					m_refCatalogues.Add(newCat);
				}
			}


			if (existing.m_compiledSets != null)
			{
				foreach (LocalCompiledPolicySetCache existingCPS in existing.m_compiledSets)
				{
					LocalCompiledPolicySetCache newCPS = new LocalCompiledPolicySetCache(existingCPS);
                    newCPS.ObjectModified += new ObjectModifiedEventHandler(OnObjectModified);
					m_compiledSets.Add(newCPS);
				}
			}

			Latest = latest;
		}
		public ICompiledPolicySetCache NewCompiledPolicySet(string channel, string target, string content, string objects)
		{
            ValidateChanges();
			LocalCompiledPolicySetCache lcps = new LocalCompiledPolicySetCache(channel, target, content, objects);
            lcps.ObjectModified += new ObjectModifiedEventHandler(OnObjectModified);

			m_compiledSets.Add(lcps);
			return lcps;
		}
        protected virtual void AddCompiledPolicySets(XmlDocument xmlDoc)
        {
            XmlNodeList compiledSets = xmlDoc.SelectNodes("/PolicySet/CompiledPolicySets/CompiledPolicySet");
            foreach (XmlNode compiledSet in compiledSets)
            {
                string target = compiledSet.Attributes.GetNamedItem("target").Value;
                string channel = compiledSet.Attributes.GetNamedItem("channel").Value;
                string cps_content = compiledSet.SelectSingleNode("Content").InnerXml;
                string cps_objects = compiledSet.SelectSingleNode("Objects").InnerXml;

                LocalCompiledPolicySetCache comp = new LocalCompiledPolicySetCache(channel, target, cps_content, cps_objects);
                comp.ObjectModified += new ObjectModifiedEventHandler(OnObjectModified);

                try
				{ 
					comp.ID = Convert.ToInt64(compiledSet.Attributes.GetNamedItem("id").Value, CultureInfo.InvariantCulture);
				}
				catch( Exception ex)
				{
	                Logger.LogError("Unable to retrieve id from local policy file");
					Logger.LogError(ex);
				}

                comp.LoadLanguages(compiledSet.SelectNodes("Languages/Language"));

                m_compiledSets.Add(comp);
            }
        }