class RegistrationUnitController {

	@PostMapping
	@RequestMapping("_search")
	public ResponseEntity<?> search(@RequestBody @Valid RequestInfoWrapper requestInfoWrapper,
			BindingResult bindingResultsForRequestInfoWrapper,
			@ModelAttribute @Valid RegistrationUnitSearchCriteria regnUnitSearchCriteria,
			BindingResult bindingResultsForSearchCriteria) {

		LOGGER.info("requestInfoWrapper : " + requestInfoWrapper);
		LOGGER.info("regnUnitSearchCriteria : " + regnUnitSearchCriteria);

		RequestInfo requestInfo = requestInfoWrapper.getRequestInfo();

		ResponseEntity<?> errorResponseEntity = errorHandler.handleBindingErrorsForSearch(requestInfo,
				bindingResultsForRequestInfoWrapper, bindingResultsForSearchCriteria);

		if (errorResponseEntity != null)
			return errorResponseEntity;

		List<RegistrationUnit> registrationUnitsList = null;

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

		return getSuccessResponse(registrationUnitsList, requestInfo);
	}

}