class RegistrationUnitController {

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

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

		RequestInfo requestInfo = regnUnitRequest.getRequestInfo();
		/**
		 * @Validation_for_DuplicateRecord
		 */
		registrationUnitValidator.validate(regnUnitRequest, regnUnitRequestBindingResults);

		if (regnUnitRequestBindingResults.hasErrors())
			return new ResponseEntity<>(errorHandler.getErrorResponse(regnUnitRequestBindingResults, requestInfo),
					HttpStatus.BAD_REQUEST);
		
		/*ResponseEntity<?> errorResponseEntity = errorHandler.handleBindingErrorsForCreate(requestInfo,
				regnUnitRequestBindingResults);
		if (errorResponseEntity != null)
			return errorResponseEntity;*/

		List<RegistrationUnit> registrationUnitsList = null;

		try {
			registrationUnitsList = registrationUnitService.createAsync(regnUnitRequest);
		} catch (Exception e) {
			LOGGER.error(" Error While Procssing the Request!");
			return errorHandler.getUnExpectedErrorResponse(regnUnitRequestBindingResults, requestInfo,
					"Encountered : " + e.getMessage());
		}

		return getSuccessResponse(registrationUnitsList, requestInfo);
	}

}