class ChartOfAccountController {

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

		ModelMapper mapper = new ModelMapper();
		ChartOfAccountSearch domain = new ChartOfAccountSearch();
		mapper.map(chartOfAccountSearchContract, domain);
		ChartOfAccountContract contract;
		ModelMapper model = new ModelMapper();
		List<ChartOfAccountContract> chartOfAccountContracts = new ArrayList<>();
		Pagination<ChartOfAccount> chartofaccounts = chartOfAccountService.search(domain, errors);

		for (ChartOfAccount chartOfAccount : chartofaccounts.getPagedData()) {
			contract = new ChartOfAccountContract();
			model.map(chartOfAccount, contract);
			chartOfAccountContracts.add(contract);
		}

		ChartOfAccountResponse response = new ChartOfAccountResponse();
		response.setChartOfAccounts(chartOfAccountContracts);
		response.setPage(new PaginationContract(chartofaccounts));
		response.setResponseInfo(getResponseInfo(requestInfo));

		return response;

	}

}