private ItemModel CreateNewItem(object identifierObject, IItemModelRepository repository, ResolveSitecoreItemSettings settings, ILogger logger, PipelineContext pipelineContext, string language)
        {
            IValueReader valueReader = this.GetValueReader(settings.ItemNameValueAccessor);

            if (valueReader == null)
            {
                return((ItemModel)null);
            }
            DataAccessContext context       = new DataAccessContext();
            string            validItemName = this.ConvertValueToValidItemName(this.ReadValue(identifierObject, valueReader, context), logger, pipelineContext);

            if (validItemName == null)
            {
                return((ItemModel)null);
            }


            Guid id = repository.Create(validItemName, settings.TemplateForNewItem, settings.ParentItemIdItem, language);

            return(repository.Get(id, (string)null, 0));
        }
        public bool Sync()
        {
            try
            {
                Guid pipelineItemId = Guid.Parse(SalesforceDefPipelineBatchId);
                IItemModelRepository itemModelRepo          = Sitecore.DataExchange.Context.ItemModelRepository;
                ItemModel            pipelineBatchItemModel = itemModelRepo.Get(pipelineItemId);
                var                  converter            = pipelineBatchItemModel.GetConverter <PipelineBatch>(Sitecore.DataExchange.Context.ItemModelRepository);
                var                  convertResult        = converter.Convert(pipelineBatchItemModel);
                PipelineBatch        pipelineBatch        = convertResult.ConvertedValue;
                PipelineBatchContext pipelineBatchContext = new PipelineBatchContext();
                var                  runner = new InProcessPipelineBatchRunner();
                runner.RunAsync(pipelineBatch, pipelineBatchContext);

                Log.Info("Successfully synced xConnect contact to Salesforce on session end via DEF", this);
                return(true);
            }
            catch (Exception ex)
            {
                Log.Error($"Error syncing xConnect contact to Salesforce on session end via DEF. PipelineBatchId = {SalesforceDefPipelineBatchId}", ex, this);
                return(false);
            }
        }