class MarriageDocumentTypeService {

	public ResponseEntity<?> updateAsync(MarriageDocTypeRequest marriageDocTypeRequest) {
		log.info("Service:: MarriageDocTypeRequest: " + marriageDocTypeRequest);
		RequestInfo requestInfo = marriageDocTypeRequest.getRequestInfo();
		List<Long> ids = marriageDocumentTypeRepository.getIds(marriageDocTypeRequest.getMarriageDocTypes());

		List<MarriageDocumentType> updateMarriageDocumentType = new ArrayList<>();
		List<MarriageDocumentType> insertMarriageDocumentType = new ArrayList<>();

		for (MarriageDocumentType marriageDocumentType : marriageDocTypeRequest.getMarriageDocTypes()) {
			if (ids.contains(marriageDocumentType.getId())) {
				updateMarriageDocumentType.add(marriageDocumentType);
			} else {
				insertMarriageDocumentType.add(marriageDocumentType);
			}
		}
		if (!insertMarriageDocumentType.isEmpty() && insertMarriageDocumentType != null) {
			MarriageDocTypeRequest mdtReq = new MarriageDocTypeRequest();
			mdtReq.setRequestInfo(requestInfo);
			mdtReq.setMarriageDocTypes(insertMarriageDocumentType);
			createAsync(mdtReq);
		}
		log.info("Service after IDs set:: MarriageDocTypeRequest: " + marriageDocTypeRequest);
		System.err.println("marriageDocumentTypeSERVICE ENTERing KAFKA: ");
		kafkaTemplate.send(propertiesManager.getUpdateMarriageDocumentTypeTopicName(), marriageDocTypeRequest);
		return getSuccessResponse(marriageDocTypeRequest.getMarriageDocTypes(), requestInfo);
	}

}