class RecoveryController {

    @PostMapping("/_search")
    @ResponseBody
    @ResponseStatus(HttpStatus.OK)
    public RecoveryResponse search(@ModelAttribute RecoverySearchContract recoverySearchContract, @RequestBody RequestInfo requestInfo,
                                   BindingResult errors,@RequestParam String tenantId) {

        ModelMapper mapper = new ModelMapper();
        RecoverySearch domain = new RecoverySearch();
        mapper.map(recoverySearchContract, domain);
        RecoveryContract contract;
        ModelMapper model = new ModelMapper();
        List<RecoveryContract> recoveryContracts = new ArrayList<>();
        Pagination<Recovery> recoverys = recoveryService.search(domain, errors);

        if (recoverys.getPagedData() != null) {
            for (Recovery recovery : recoverys.getPagedData()) {
                contract = new RecoveryContract();
                model.map(recovery, contract);
                recoveryContracts.add(contract);
            }
        }

        RecoveryResponse response = new RecoveryResponse();
        response.setRecoverys(recoveryContracts);
        response.setPage(new PaginationContract(recoverys));
        response.setResponseInfo(getResponseInfo(requestInfo));

        return response;

    }

}