class AccountEntityController {

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

        ModelMapper mapper = new ModelMapper();
        AccountEntitySearch domain = new AccountEntitySearch();
        mapper.map(accountEntitySearchContract, domain);
        AccountEntityContract contract;
        ModelMapper model = new ModelMapper();
        List<AccountEntityContract> accountEntityContracts = new ArrayList<>();
        Pagination<AccountEntity> accountentities = accountEntityService.search(domain, errors);

        for (AccountEntity accountEntity : accountentities.getPagedData()) {
            contract = new AccountEntityContract();
            model.map(accountEntity, contract);
            accountEntityContracts.add(contract);
        }

        AccountEntityResponse response = new AccountEntityResponse();
        response.setAccountEntities(accountEntityContracts);
        response.setPage(new PaginationContract(accountentities));
        response.setResponseInfo(getResponseInfo(requestInfo));

        return response;

    }

}