class ModelValidator {

    public List<ValidationError> getModelValidationErrors(Object object, Class validationGroup) {
        if (object == null) {
            return ImmutableList.of(ValidationError.of("", "object is null"));
        }
        Set<ConstraintViolation<Object>> violations = validator.validate(object, validationGroup);
        Set<String> errorFields = new HashSet<>();
        ImmutableList.Builder<ValidationError> errors = ImmutableList.builder();
        for (ConstraintViolation<Object> v : violations) {
            String field = v.getPropertyPath().toString();
            if (!errorFields.contains(field)) {
                errors.add(ValidationError.of(field, v.getMessage()));
                errorFields.add(field);
            }
        }
        return errors.build();
    }

    public  ModelValidator(Validator validator, ObjectMapper mapper);

}