internal static ExtensionDescriptor ConvertToExtensionDescriptor(this ThemeManifest themeManifest)
        {
            var descriptor = new ExtensionDescriptor
            {
                ExtensionType = "Theme",
                Location = "~/Themes",
                Path = themeManifest.Path,
                Id = themeManifest.ThemeName,
                Author = themeManifest.Author.HasValue() ? themeManifest.Author : "[Unknown]",
                MinAppVersion = SmartStoreVersion.Version, // TODO: (pkg) Add SupportedVersion to theme manifests
                Version = new Version(themeManifest.Version),
                Name = themeManifest.ThemeTitle,
                Description = string.Empty, // TODO: (pkg) Add description to theme manifests
                WebSite = string.Empty, // TODO: (pkg) Add author url to theme manifests,
                Tags = string.Empty // TODO: (pkg) Add tags to theme manifests,
            };

            return descriptor;
        }
		internal static ExtensionDescriptor ConvertToExtensionDescriptor(this PluginDescriptor pluginDescriptor)
		{
			// TODO: (pkg) Add Icons to extension manifests
			var descriptor = new ExtensionDescriptor
			{
				ExtensionType = "Plugin",
				Location = "~/Plugins",
				Id = pluginDescriptor.FolderName,
				Author = pluginDescriptor.Author,
				MinAppVersion = pluginDescriptor.MinAppVersion,
				Version = pluginDescriptor.Version,
				Name = pluginDescriptor.FriendlyName,
				Description = pluginDescriptor.Description,
				WebSite = string.Empty, // TODO: (pkg) Add author url to plugin manifests,
				Tags = string.Empty // TODO: (pkg) Add tags to plugin manifests
			};

			return descriptor;
		}
		private Stream BuildPackage(ExtensionDescriptor extensionDescriptor)
		{
			var context = new BuildContext();
			BeginPackage(context);
			try
			{
				EstablishPaths(context, _webSiteFolder, extensionDescriptor.Location, extensionDescriptor.Id, extensionDescriptor.ExtensionType);
				SetCoreProperties(context, extensionDescriptor);
				EmbedFiles(context);
			}
			finally
			{
				EndPackage(context);
			}

			if (context.Stream.CanSeek)
			{
				context.Stream.Seek(0, SeekOrigin.Begin);
			}

			return context.Stream;
		}
        private static void SetCoreProperties(BuildContext context, ExtensionDescriptor extensionDescriptor)
        {
            context.Builder.Id = PackagingUtils.BuildPackageId(extensionDescriptor.Id, extensionDescriptor.ExtensionType);
            context.Builder.Version = new SemanticVersion(extensionDescriptor.Version);
            context.Builder.Title = extensionDescriptor.Name ?? extensionDescriptor.Id;
            context.Builder.Description = extensionDescriptor.Description.NullEmpty() ?? "No Description";
            context.Builder.Authors.Add(extensionDescriptor.Author ?? "Unknown");

            if (Uri.IsWellFormedUriString(extensionDescriptor.WebSite, UriKind.Absolute))
            {
                context.Builder.ProjectUrl = new Uri(extensionDescriptor.WebSite);
            }
        }