/// <summary>
		/// Setup constructor
		/// </summary>
		/// <param name="policySet">Policy set to build</param>
		/// <param name="encoding">String encoding used when reading from the zip file</param>
		/// <param name="factory">Factory, used from creating version cache objects</param>
		public PolicySetCacheBuilder(IPolicySetCache policySet, Encoding encoding, VersionFactory factory)
		{
			m_PolicySet = policySet;
			m_Encoding = encoding;
			m_Factory = factory;
		}
		/// <summary>
		/// Creates a new version from the latest version in an IPolicySetCache
		/// </summary>
		public static IPolicySetVersionCache NewVersionFromLatest(IPolicySetCache cache, VersionFactory factory, PolicySetVersionStatus status)
		{
			IPolicySetVersionCache existingVersion = cache.LatestVersion;
			string newVersionNumber = NextVersion(existingVersion.Version);
			existingVersion.Latest = false;

			IPolicySetVersionCache newVersion = factory.NewVersionCache(existingVersion, newVersionNumber, true, status);
			cache.PolicySetVersions.Add(newVersion);

			return newVersion;
		}
		/// <summary>
		/// Sets the version status, according to save option
		/// </summary>
		public static void SetSaveVersionStatus(IPolicySetCache cache, VersionFactory factory, SaveOption option)
		{
			IPolicySetVersionCache ver = cache.LatestVersion;
			switch (option)
			{
				case SaveOption.Delete:
					ver.Status = PolicySetVersionStatus.Deleted; break;
				case SaveOption.Disable:
					{
						DisableOldVersions(cache);

						if (ver.Status == PolicySetVersionStatus.Enabled)
							ver.Status = PolicySetVersionStatus.Disabled;
					}
					break;
				case SaveOption.SaveOnly:
					{
						if (PolicySetVersionStatus.Enabled != ver.Status)
							ver.Status = PolicySetVersionStatus.InProgress;
					}
					break;
				case SaveOption.SaveNew:
					{
						if (ver.Status == PolicySetVersionStatus.Enabled)
							ver = NewVersionFromLatest(cache, factory, PolicySetVersionStatus.InProgress);
						else
							ver.Status = PolicySetVersionStatus.InProgress;
					}
					break;
				case SaveOption.Publish:
					{
						if (ver.Status == PolicySetVersionStatus.InProgress ||
							ver.Status == PolicySetVersionStatus.Disabled)
							ver.Status = PolicySetVersionStatus.Enabled;
						else if (ver.Status == PolicySetVersionStatus.Enabled)
							ver = NewVersionFromLatest(cache, factory, PolicySetVersionStatus.Enabled);

						DisableOldVersions(cache);
					}
					break;
				default:
					{
						Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
							"STATUS_NOT_IMPL", "Workshare.Policy.ClientCache.Properties.Resources",
							System.Reflection.Assembly.GetExecutingAssembly());
						Logger.LogError(errorMessage.LogString);
						throw new Exception(errorMessage.DisplayString);
					}
			}
		}