class SpendProfileValidationUtil {

    public Optional<ValidationMessages> validateSpendProfileTableResource(SpendProfileTableResource tableResource) {

        Optional<ValidationMessages> result = Optional.empty();

        BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(tableResource, "spendProfileTable");
        ValidationUtils.invokeValidator(spendProfileCostValidator, tableResource, bindingResult);

        if (bindingResult.hasErrors()) {
            ValidationMessages messages = new ValidationMessages(bindingResult);
            result = Optional.of(messages);
        }

        return result;
    }

}