public Guid IpDetailsUpdateJob(IEnumerable <IpDetail> ipDetails)
        {
            Guid guid = Guid.NewGuid();

            // initialize the progress
            BatchJobHelperService.UpdateJobProgress(guid, $"0/{ipDetails.Count()}");

            var t = Task.Run(async() =>
            {
                using var scope = ServiceScopeFactory.CreateScope();

                var _ipDetailsRepository = scope.ServiceProvider.GetRequiredService <IIPDetailsRepository>();

                var currentIds = ipDetails;

                int progress = 0;

                while (currentIds.Any())
                {
                    // update entries in DB
                    await _ipDetailsRepository.UpdateIpDetailsAsync(currentIds.Take(batchSize));

                    // if the request has less items that the batchsize then i want the progress to write it correctly
                    progress += batchSize > currentIds.Count() ? currentIds.Count() : batchSize;

                    currentIds = currentIds.Skip(batchSize);

                    // update progress
                    BatchJobHelperService.UpdateJobProgress(guid, $"{progress}/{ipDetails.Count()}");

                    // update cache
                    await IpRequestHandlerService.UpdateManyCacheAsync(currentIds.Take(batchSize));
                }
            });

            return(guid);
        }
 public string GetUpdateJobProgress(Guid updateJobGuid)
 {
     return(BatchJobHelperService.GetJobProgress(updateJobGuid));
 }