class ArchiveInfraRequestsScheduler {

    protected void archiveInfraRequests(List<InfraActiveRequests> requests) throws ScheduledTaskException {
        List<ArchivedInfraRequests> newArchivedReqs = new ArrayList<>();
        List<InfraActiveRequests> oldInfraReqs = new ArrayList<>();

        for (InfraActiveRequests iar : requests) {
            ArchivedInfraRequests archivedInfra = new ArchivedInfraRequests();
            try {
                archivedInfra.setCloudRegion(iar.getCloudRegion());
                archivedInfra.setCallBackUrl(iar.getCallBackUrl());
                archivedInfra.setConfigurationId(iar.getConfigurationId());
                archivedInfra.setConfigurationName(iar.getConfigurationName());
                archivedInfra.setCorrelator(iar.getCorrelator());
                archivedInfra.setEndTime(iar.getEndTime());
                archivedInfra.setLastModifiedBy(iar.getLastModifiedBy());
                archivedInfra.setNetworkId(iar.getNetworkId());
                archivedInfra.setNetworkName(iar.getNetworkName());
                archivedInfra.setNetworkType(iar.getNetworkType());
                archivedInfra.setOperationalEnvId(iar.getOperationalEnvId());
                archivedInfra.setOperationalEnvName(iar.getOperationalEnvName());
                archivedInfra.setRequestUrl(iar.getRequestUrl());
                archivedInfra.setProgress(iar.getProgress());
                archivedInfra.setRequestAction(iar.getRequestAction());
                archivedInfra.setRequestBody(iar.getRequestBody());
                archivedInfra.setRequestId(iar.getRequestId());
                archivedInfra.setRequestorId(iar.getRequestorId());
                archivedInfra.setRequestScope(iar.getRequestScope());
                archivedInfra.setRequestStatus(iar.getRequestStatus());
                archivedInfra.setResponseBody(iar.getResponseBody());
                archivedInfra.setServiceInstanceId(iar.getServiceInstanceId());
                archivedInfra.setServiceInstanceName(iar.getServiceInstanceName());
                archivedInfra.setServiceType(iar.getServiceType());
                archivedInfra.setSource(iar.getSource());
                archivedInfra.setStartTime(iar.getStartTime());
                archivedInfra.setStatusMessage(iar.getStatusMessage());
                archivedInfra.setTenantId(iar.getTenantId());
                archivedInfra.setVfModuleId(iar.getVfModuleId());
                archivedInfra.setVfModuleModelName(iar.getVfModuleModelName());
                archivedInfra.setVfModuleName(iar.getVfModuleName());
                archivedInfra.setVnfId(iar.getVnfId());
                archivedInfra.setVnfName(iar.getVnfName());
                archivedInfra.setVnfOutputs(iar.getVnfOutputs());
                archivedInfra.setVnfParams(iar.getVnfParams());
                archivedInfra.setVnfType(iar.getVnfType());
                archivedInfra.setVolumeGroupId(iar.getVolumeGroupId());
                archivedInfra.setVolumeGroupName(iar.getVolumeGroupName());
                archivedInfra.setProductFamilyName(iar.getProductFamilyName());
                archivedInfra.setTenantName(iar.getTenantName());
                archivedInfra.setResourceStatusMessage(iar.getResourceStatusMessage());
                archivedInfra.setWorkflowName(iar.getWorkflowName());
                archivedInfra.setOperationName(iar.getOperationName());

                newArchivedReqs.add(archivedInfra);
                oldInfraReqs.add(iar);
            } catch (Exception e) {
                throw new ScheduledTaskException(ErrorCode.UnknownError, e.getMessage(), e);
            }
        }

        logger.info("Creating archivedInfraRequest records: {}", newArchivedReqs.size());
        archivedInfraRepo.saveAll(newArchivedReqs);

        logger.info("Deleting InfraActiveRequest records: {}", oldInfraReqs.size());
        infraActiveRepo.deleteAll(oldInfraReqs);
    }

}