public ConfigurationProperty create(String key, String value, String encryptedValue, Boolean isSecure) {

        ConfigurationProperty configurationProperty = new ConfigurationProperty();
        configurationProperty.setConfigurationKey(new ConfigurationKey(key));

        if (isNotBlank(value) && isNotBlank(encryptedValue)) {
            configurationProperty.addError("configurationValue", "You may only specify `value` or `encrypted_value`, not both!");
            configurationProperty.addError("encryptedValue", "You may only specify `value` or `encrypted_value`, not both!");

            configurationProperty.setConfigurationValue(new ConfigurationValue(value));
            configurationProperty.setEncryptedValue(new EncryptedConfigurationValue(encryptedValue));
            return configurationProperty;
        }

        if (isSecure) {
            if (isNotBlank(encryptedValue)) {
                configurationProperty.setEncryptedValue(new EncryptedConfigurationValue(encryptedValue));
            }

            if (isNotBlank(value)) {
                configurationProperty.setEncryptedValue(new EncryptedConfigurationValue(encrypt(value)));
            }

        } else {
            if (isNotBlank(encryptedValue)) {
                configurationProperty.addError("encryptedValue", "encrypted_value cannot be specified to a unsecured property.");
                configurationProperty.setEncryptedValue(new EncryptedConfigurationValue(encryptedValue));
            }

            if (value != null) {
                configurationProperty.setConfigurationValue(new ConfigurationValue(value));
            }
        }

        if (isNotBlank(configurationProperty.getEncryptedValue())) {
            configurationProperty.setEncryptedValue(new EncryptedConfigurationValue(configurationProperty.getEncryptedValue()));
        }
        return configurationProperty;
    }
@Test
    public void shouldCreateWithErrorsInPresenceOfEncryptedTextInputForUnSecuredProperty() {
        Property key = new Property("key");
        key.with(Property.SECURE, false);

        ConfigurationProperty property = new ConfigurationPropertyBuilder().create("key", null, "enc_value", false);

        assertThat(property.errors().get("encryptedValue").get(0), is("encrypted_value cannot be specified to a unsecured property."));
        assertThat(property.getEncryptedValue(), is("enc_value"));
    }