private List<String> getErrorMessages(Object form, Class<?>[] groups) {

        List<String> errorMessages = new ArrayList<String>();
        if (form == null) {
            return errorMessages;
        }

        Set<ConstraintViolation<Object>> validate = validator.validate(form, groups);
        if (CollectionUtils.isEmpty(validate)) {
            return errorMessages;
        }

        for (ConstraintViolation<Object> constraintViolation : validate) {
            errorMessages.add(constraintViolation.getMessage());
        }
        return errorMessages;
    }