private void InitProviders(string providerPath)
        {
            lock (_syncObj)
            {
                if (_providersInititialized)
                {
                    return;
                }

                _providersInititialized           = true;
                _listProviders                    = new ContentListProviderDictionary();
                _listProviders.ProviderRequested += OnProviderRequested;

                _providerPluginItemStateTracker = new FixedItemStateTracker($"Content Lists - Provider registration for path {providerPath}");

                IPluginManager pluginManager = ServiceRegistration.Get <IPluginManager>();
                foreach (PluginItemMetadata itemMetadata in pluginManager.GetAllPluginItemMetadata(providerPath))
                {
                    try
                    {
                        ContentListProviderRegistration providerRegistration = pluginManager.RequestPluginItem <ContentListProviderRegistration>(providerPath, itemMetadata.Id, _providerPluginItemStateTracker);
                        if (providerRegistration == null)
                        {
                            ServiceRegistration.Get <ILogger>().Warn("Could not instantiate Content List provider with id '{0}'", itemMetadata.Id);
                        }
                        else
                        {
                            IContentListProvider provider = Activator.CreateInstance(providerRegistration.ProviderClass) as IContentListProvider;
                            if (provider == null)
                            {
                                throw new PluginInvalidStateException("Could not create IContentListProvider instance of class {0}", providerRegistration.ProviderClass);
                            }
                            if (_listProviders.ContainsKey(providerRegistration.Key))
                            {
                                //The default providers cannot replace existing providers
                                if (provider.GetType().Assembly != System.Reflection.Assembly.GetExecutingAssembly())
                                {
                                    //Replace the provider
                                    _listProviders[providerRegistration.Key] = provider;
                                    ServiceRegistration.Get <ILogger>().Info("Successfully replaced Content List '{1}' with provider '{0}' (Id '{2}')", itemMetadata.Attributes["ClassName"], itemMetadata.Attributes["Key"], itemMetadata.Id);
                                }
                            }
                            else
                            {
                                _listProviders.Add(providerRegistration.Key, provider);
                                ServiceRegistration.Get <ILogger>().Info("Successfully activated Content List '{1}' with provider '{0}' (Id '{2}')", itemMetadata.Attributes["ClassName"], itemMetadata.Attributes["Key"], itemMetadata.Id);
                            }
                        }
                    }
                    catch (PluginInvalidStateException e)
                    {
                        ServiceRegistration.Get <ILogger>().Warn("Cannot add IContentListProvider extension with id '{0}'", e, itemMetadata.Id);
                    }
                }
            }
        }
 protected virtual async Task <bool> UpdateProviderAsync(IContentListProvider provider, int maxItems, UpdateReason updateReason)
 {
     try
     {
         return(await provider.UpdateItemsAsync(maxItems, updateReason));
     }
     catch (Exception ex)
     {
         ServiceRegistration.Get <ILogger>().Error("Error updating Content List {0}", ex, provider.GetType().Name);
         return(false);
     }
 }