Inheritance: VirtoCommerce.Platform.Core.PushNotifications.PushNotification
        public void ModulesImportBackground(ImportManifest importManifest, ModulePublishingPushNotification pushNotification)
        {
            Action<ImportProcessInfo> progressCallback = (x) =>
            {
                pushNotification.InjectFrom(x);
                pushNotification.Errors = x.Errors;
                _pushNotifier.Upsert(pushNotification);
            };

            try
            {
                _moduleImporter.DoImport(importManifest, progressCallback);
            }
            catch (Exception ex)
            {
                pushNotification.Errors.Add(ex.ToString());
            }
            finally
            {
                pushNotification.Finished = DateTime.UtcNow;
                pushNotification.Description = "Import finished";
                _pushNotifier.Upsert(pushNotification);
            }

        }
        public IHttpActionResult Publish(ImportManifest importManifest)
        {
            var settingsManager = ServiceLocator.Current.GetInstance<ISettingsManager>();
            var packagesPath = settingsManager.GetValue("VirtoCommerce.ModulesPublishing.AppStoreImport.PackagesPath", String.Empty);

            importManifest.DefaultCategoryCode = settingsManager.GetValue("VirtoCommerce.ModulesPublishing.AppStoreImport.DefaultCategoryCode", String.Empty);
            importManifest.PackagesPath = HttpContext.Current.Server.MapPath(packagesPath);

            var notification = new ModulePublishingPushNotification(CurrentPrincipal.GetCurrentUserName())
            {
                Title = "Import applications task",
                Description = "Task added and will start soon...."
            };

            if (string.IsNullOrEmpty(importManifest.DefaultCategoryCode))
            {
                notification.Errors.Add("Set 'Category code' setting, before import.");
            }
            if (string.IsNullOrEmpty(packagesPath))
            {
                notification.Errors.Add("Set 'Packages folder' setting, before import.");
            }
            if (!Directory.Exists(importManifest.PackagesPath))
            {
                notification.Errors.Add(string.Format("Path doesn't exists: {0}", importManifest.PackagesPath));
            }

            if (notification.Errors.Count == 0)
            {
                BackgroundJob.Enqueue(() => ModulesImportBackground(importManifest, notification));
            }

            _pushNotifier.Upsert(notification);
            return Ok(notification);

        }