Added condition to not store record multiple times, and bulk save the errors.
Store the failed records in the chunk while processing.
Merged the code in production branch for setting, task and report microservice.