public void clearEmptyConfigurations() {
        List<ConfigurationProperty> propertiesToRemove = new ArrayList<>();
        for (ConfigurationProperty configurationProperty : this) {
            ConfigurationValue configurationValue = configurationProperty.getConfigurationValue();
            EncryptedConfigurationValue encryptedValue = configurationProperty.getEncryptedConfigurationValue();

            if (StringUtils.isBlank(configurationProperty.getValue()) && (configurationValue == null || configurationValue.errors().isEmpty()) && (encryptedValue == null || encryptedValue.errors().isEmpty())) {
                propertiesToRemove.add(configurationProperty);
            }
        }
        this.removeAll(propertiesToRemove);
    }
@Test
    void shouldClearConfigurationsWhichAreEmptyAndNoErrors() throws Exception {
        Configuration configuration = new Configuration();
        configuration.add(new ConfigurationProperty(new ConfigurationKey("name-one"), new ConfigurationValue()));
        configuration.add(new ConfigurationProperty(new ConfigurationKey("name-two"), new EncryptedConfigurationValue()));
        configuration.add(new ConfigurationProperty(new ConfigurationKey("name-three"), null, new EncryptedConfigurationValue(), null));

        ConfigurationProperty configurationProperty = new ConfigurationProperty(new ConfigurationKey("name-four"), null, new EncryptedConfigurationValue(), null);
        configurationProperty.addErrorAgainstConfigurationValue("error");
        configuration.add(configurationProperty);

        configuration.clearEmptyConfigurations();

        assertThat(configuration.size()).isEqualTo(1);
        assertThat(configuration.get(0).getConfigurationKey().getName()).isEqualTo("name-four");

    }