public void ProcessJob(TaskScheduling task)
 {
     try
     {
         ServicesAdministrationServiceClient adminClient  = new ServicesAdministrationServiceClient(true);
         ServicesSearchServiceClient         searchClient = new ServicesSearchServiceClient(false);
         IdentityStore   store                   = adminClient.GetIdentityStoreById(task.get_IdentityStoreId(), true);
         KnownAttributes knownAttributes         = searchClient.GetKnownAttributes(task.get_IdentityStoreId());
         List <PermissionAnalyzerServer> servers = new List <PermissionAnalyzerServer>();
         Dictionary <string, Dictionary <int, string> > configurations = this.LoadConfigurations(store, adminClient, servers, knownAttributes);
         List <Schema> schema = adminClient.GetIdentityStoreSchema(task.get_IdentityStoreId());
         if (servers.Count > 0)
         {
             (new Imanami.PermissionReplicationService.PermissionReplicationService(store, configurations, schema, knownAttributes)).ReplicatePermissions(1, servers);
         }
     }
     catch (Exception exception)
     {
         LogExtension.LogException(PermissionAnalyzer.logger, "Error While Replicating Permissions.", exception);
     }
     PermissionAnalyzer.logger.InfoFormat("Job processed successfully.", Array.Empty <object>());
 }
        public static IStoreTypeHelper GetStoreTypeHelper(int identityStoreId)
        {
            IStoreTypeHelper storeTypeHelper;

            try
            {
                ServicesAdministrationServiceClient adminClient = new ServicesAdministrationServiceClient(false);
                StoreType storeType = adminClient.GetIdentityStoreById(identityStoreId, false).get_StoreType();
                if (storeType != null)
                {
                    storeTypeHelper = StoreTypeHelperFactory.get_Instance().GetStoreTypeHelper(storeType.get_StoreTypeName());
                    return(storeTypeHelper);
                }
            }
            catch (Exception exception)
            {
                Exception ex = exception;
                Helper.logger.Error(string.Concat("Error occurred while getting store type helper. ", ex.Message), ex);
            }
            storeTypeHelper = null;
            return(storeTypeHelper);
        }