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;
		}
		internal IPolicySetVersionCache NewSuperSet(string xml, PolicySetVersionStatus status)
		{
			IPolicySetVersionCache old_lpsv = null;

			foreach (LocalPolicySetVersionCache lpsv in m_policySetVersions)
			{
				if (lpsv.Latest)
				{
					lpsv.Latest = false;
					old_lpsv = lpsv;
					break;
				}
			}

			LocalPolicySetVersionCache new_lpsv;

            if (old_lpsv == null)
            {
                double ver = 1.0d;
                new_lpsv = new LocalPolicySetVersionCache(xml, ver.ToString("N1", CultureInfo.CurrentCulture), status, true);
            }
            else
                new_lpsv = new LocalPolicySetVersionCache(xml, GetNewVersionString(old_lpsv.Version), status, true);

			m_policySetVersions.Add(new_lpsv);
			return new_lpsv;
		}
		private LocalPolicySetVersionCache NewVersionFromLatest(PolicySetVersionStatus status)
		{
			LocalPolicySetVersionCache existingVersion = (LocalPolicySetVersionCache)LatestVersion;
			string newVersionNumber = GetNewVersionString(LatestVersion.Version);
			existingVersion.Latest = false;
			
			LocalPolicySetVersionCache newVersion = new LocalPolicySetVersionCache(existingVersion, newVersionNumber, true, status);
			m_policySetVersions.Add(newVersion);
			return newVersion;
		}
		public IPolicySetVersionCache NewVersion(string content, string version)
		{
			LocalPolicySetVersionCache old_lpsv = LatestVersion as LocalPolicySetVersionCache;
			LocalPolicySetVersionCache new_lpsv;

			if (old_lpsv != null)
				old_lpsv.Latest = false;

			new_lpsv = new LocalPolicySetVersionCache(m_id, content, version);			

			m_policySetVersions.Add(new_lpsv);
			return new_lpsv;
		}
		public IPolicySetVersionCache NewVersion(string content)
		{
			LocalPolicySetVersionCache old_lpsv = LatestVersion as LocalPolicySetVersionCache;
			LocalPolicySetVersionCache new_lpsv;

            if (old_lpsv == null)
            {
                double ver = 1.0d;
                new_lpsv = new LocalPolicySetVersionCache(m_id, content, ver.ToString("N1", CultureInfo.CurrentCulture));
            }
            else
            {
                old_lpsv.Latest = false;
                new_lpsv = new LocalPolicySetVersionCache(m_id, content, GetNewVersionString(old_lpsv.Version));
            }
			
			m_policySetVersions.Add(new_lpsv);
			return new_lpsv;
		}
		protected virtual void CreateVersion(string xml, string version, PolicySetVersionStatus status, bool latest)
		{
            if (m_bDecryptXML)
                xml = Crypto.Instance.DecryptXml(xml);

			LocalPolicySetVersionCache psv = new LocalPolicySetVersionCache(xml, version, status, latest);
			m_policySetVersions.Add(psv);
		}