@JsonIgnore
    public ValidationResult validate(@Nullable EventDefinitionDto oldEventDefinitionDto,
                                     EventDefinitionConfiguration eventDefinitionConfiguration) {
        final ValidationResult validation = new ValidationResult();

        if (title().isEmpty()) {
            validation.addError(FIELD_TITLE, "Event Definition title cannot be empty.");
        }

        try {
            validation.addAll(config().validate());
            validation.addAll(config().validate(
                    Optional.ofNullable(oldEventDefinitionDto).map(EventDefinitionDto::config).orElse(null),
                    eventDefinitionConfiguration));
        } catch (UnsupportedOperationException e) {
            validation.addError(FIELD_CONFIG, "Event Definition config type cannot be empty.");
        }

        for (Map.Entry<String, EventFieldSpec> fieldSpecEntry : fieldSpec().entrySet()) {
            final String fieldName = fieldSpecEntry.getKey();
            if (!Message.validKey(fieldName)) {
                validation.addError(FIELD_FIELD_SPEC,
                        "Event Definition field_spec contains invalid message field \"" + fieldName + "\"." +
                                " Valid message field characters are: a-z, A-Z, 0-9, ., -, and @. No spaces are allowed.");
            }
        }

        if (keySpec().stream().anyMatch(key -> !fieldSpec().containsKey(key))) {
            validation.addError(FIELD_KEY_SPEC, "Event Definition key_spec can only contain fields defined in field_spec.");
        }

        return validation;
    }
@Test
    public void testValidEventDefinition() {
        final ValidationResult validationResult = validate(testSubject);
        assertThat(validationResult.failed()).isFalse();
        assertThat(validationResult.getErrors().size()).isEqualTo(0);
    }