public static void Process(IList <KCStore> stores)
 {
     logger.SetRequestId(GetRequestId());
     for (int i = 0; i < stores.Count; i++)
     {
         var tokenSource = new CancellationTokenSource();
         try
         {
             ProcessStore(stores[i], tokenSource.Token);
             PXProcessing <KCStore> .SetInfo(i, KCMessages.BulkUploadSuccess(stores[i].SiteMasterCD));
         }
         catch (Exception exception)
         {
             string log = KCMessages.ProcessException(stores[i].SiteMasterCD, exception.Message, exception.StackTrace);
             PXTrace.WriteError(exception);
             logger.ClearLoggingIds();
             logger.Error(log);
             PXProcessing <KCStore> .SetError(i, new Exception(log));
         }
         finally
         {
             tokenSource.Cancel(true);
             tokenSource.Dispose();
         }
     }
 }
        private static void Process(IList <KCStore> stores)
        {
            LoggerProperties.RequestId = GetRequestId();
            logger = new KCLoggerProvider(LoggerProperties);

            int index = 0;

            foreach (KCStore store in stores)
            {
                try
                {
                    ProcessStore(store);
                    PXProcessing <KCStore> .SetInfo(index, $"Data Exchange for {store.SiteMasterCD} has been processed successfully");
                }
                catch (Exception exception)
                {
                    string log = KCMessages.ProcessException(store.SiteMasterCD, exception.Message, exception.StackTrace);
                    logger.ClearLoggingIds();
                    logger.Error(log);
                    PXProcessing <KCStore> .SetError(index, new Exception(log));
                }
                index++;
            }
        }