class IMSController {

    @RequestMapping(value = "/api/inventory/count", method = RequestMethod.POST)
    @ResponseBody
    public ResponseEntity getInventory(@RequestBody IMSRequestQuery payload)
    {
        InventoryResult result;
        try
        {
            result = inventoryEstimateService.aggregateInventory(payload.getTargetingChannel(), payload.getDays(),
                    payload.getPrice());

            String logMessage = String.format("Targeting channel: %s estimate: %d",
                    payload.getTargetingChannel().getQueryKey(), result.getAvailCount());
            LOGGER.info(logMessage);
        }
        catch (Exception e)
        {
            LOGGER.error(e.getMessage());
            return ResponseBuilder.buildError(e);
        }

        return ResponseBuilder.build(result, HTTP_OK_CODE);
    }

}