public void Transfer(ClaimProcessorConfiguration config)
        {
            if (!IsInitialized)
            {
                PropertyAccessorCache.InitializeCache();
                new UnderwritingService(XiapConstants.XIAP_DATASOURCE);
                MapperConfiguration.Initialize();
                IsInitialized = true;
            }
            
            Logger.Info("===============================================================================");
            Logger.Info("======================Starting Claim Processing================================");
            Logger.Info("===============================================================================");
	        
            try
            {
                if (config.FilterByPolicyReference)
                {
                    _totalClaims = GlobalClaimWakeUp.Container.Resolve<Func<string, IStagingGateway>>()(config.PolicyReferencesToInclude.First()).GetClaimByPolicyCount(
                        config.ProcessOpenClaims,
                        config.ProcessClosedClaims,
                        config.ProcessLiabilityClaims,
                        config.ProcessMotorClaims,
                        config.PolicyReferencesToInclude,
                        config.PolicyReferencesToExclude);
                }
                else
                {
                    _totalClaims = GlobalClaimWakeUp.Container.Resolve<Func<string, IStagingGateway>>()(config.ClaimsReferencesToInclude.First()).GetClaimByClaimCount(
                        config.ProcessOpenClaims,
                        config.ProcessClosedClaims,
                        config.ProcessLiabilityClaims,
                        config.ProcessMotorClaims,
                        config.ClaimsReferencesToInclude,
                        config.ClaimsReferencesToExclude);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Exception processing");
                Logger.Error(ex);
                throw ex;
            }

            Logger.InfoFormat("=======================Total Claims={0,-8}===================================", _totalClaims);
            Logger.InfoFormat("=======================Concurrency ={0,-8}===================================", _concurrency);
            if (OnUpdate != null) OnUpdate(this, new UpdateEventArgs { TotalClaims = _totalClaims, BatchSize = config.BatchSize });
            
            var index = config.StartingRecord;
            var page = Math.Max(config.BatchSize / 10, 10);
	        var postClaims = new ActionBlock<IEnumerable<Claim>>(chunk => PostClaimsToPipeline(chunk), new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = _concurrency });
            
            // ** Here for the validation that we only have Motor or only have liability claims/policies listed **

            do
            {
                IEnumerable<Claim> chunk;
                if (config.FilterByPolicyReference)
                {
                    chunk = GlobalClaimWakeUp.Container.Resolve<Func<string, IStagingGateway>>()(config.PolicyReferencesToInclude.First()).GetClaimsByPolicy(
                        page,
                        index,
                        config.ProcessOpenClaims,
                        config.ProcessClosedClaims,
                        config.ProcessLiabilityClaims,
                        config.ProcessMotorClaims,
                        config.PolicyReferencesToInclude,
                        config.PolicyReferencesToExclude);
                }
                else
                {
                    chunk = GlobalClaimWakeUp.Container.Resolve<Func<string, IStagingGateway>>()(config.ClaimsReferencesToInclude.First()).GetClaimsByClaim(
                        page,
                        index,
                        config.ProcessOpenClaims,
                        config.ProcessClosedClaims,
                        config.ProcessLiabilityClaims,
                        config.ProcessMotorClaims,
                        config.ClaimsReferencesToInclude,
                        config.ClaimsReferencesToExclude);
                }
                if (!chunk.Any()) break;
                postClaims.Post(chunk);
                index += page;
            } while (ShouldContinueProcessing(config, _totalClaims, index));

            postClaims.Complete();
            
            try
            {
                postClaims.Completion.Wait();
            }
            catch (AggregateException ex)
            {
                ex.Handle(e =>
                              {
                                  Logger.Error("Unhandled Exception!", e);
                                  return true;
                              });
            }

            if (OnComplete != null) OnComplete(this, new EventArgs());
        }
        private bool ShouldContinueProcessing(ClaimProcessorConfiguration config, int totalClaims, int index)
        {
            var shouldContinue = config.AutoSubmit ? index < totalClaims : index < config.BatchSize;

            Logger.InfoFormat("{0}", JObject.FromObject(new { config.AutoSubmit, config.BatchSize, totalClaims, index, shouldContinue }));
            return shouldContinue;
        }