class RegistrationUnitController {

	@PostMapping
	@RequestMapping("_update")
	public ResponseEntity<?> update(@RequestBody @Valid RegnUnitRequest regnUnitRequest,
			BindingResult regnUnitRequestBindingResults) {

		LOGGER.info("regnUnitRequest : " + regnUnitRequest);

		RequestInfo requestInfo = regnUnitRequest.getRequestInfo();

		ResponseEntity<?> errorResponseEntity = errorHandler.handleBindingErrorsForUpdate(requestInfo,
				regnUnitRequestBindingResults);

		if (errorResponseEntity != null)
			return errorResponseEntity;

		/**
		 * @KAFKA
		 */
		List<RegistrationUnit> registrationUnitsList = null;
		try {
			registrationUnitsList = registrationUnitService.updateAsync(regnUnitRequest);
			if (registrationUnitsList.isEmpty()) {
				return errorHandler.getUpdateErrorResponse(regnUnitRequestBindingResults, requestInfo,
						regnUnitRequest.getRegnUnit());
			}
		} catch (Exception e) {
			LOGGER.error(" Error While Procssing the Request!");
			return errorHandler.getUnExpectedErrorResponse(regnUnitRequestBindingResults, requestInfo,
					"Encountered : " + e.getCause());
		}

		return getSuccessResponse(registrationUnitsList, requestInfo);
	}

}