The custom realm attributes can not be updated, the former value is preserved
**Describe the bug**
When the realm contains a custom realm attribute, it can not be updated with consequent runs of the tool.

**To Reproduce**

1.  Add any custom attribute in the realm configuration like:
```json
{
   "realm": "my_realm",
   ...
   "attributes": {
       "custom": "value01"
   }
}
```
2. Run the `keycloak-config-cli`

3. Update your realm configuration file, like the following:  
```json
{
   "realm": "my_realm",
   ...
   "attributes": {
       "custom": "value02"
   }
}
```
4. Repeat step 2.

5. Check your realm attributes in Keycloak, the observed values would be `"custom": "value01"`.

**Expected behavior**
The custom attribute has the `value02` after step 4.

**Environment (please complete the following information):**
 - Keycloak Version: [e.g. 11.0.3]
 - keycloak-config-cli Version: [e.g. 4.0.1]
 - Java Version: [e.g. 11]


diff --git a/CHANGELOG.md b/CHANGELOG.md
index f0c4d5cf..2169e66f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 ### Fixed
 
 - Realm attributes in configuration file overwrite the realm's state when the realm is updated.
+- Custom realm attributes not updatable.
 
 ## [4.0.1] - 2021-06-19
 
diff --git a/src/main/java/de/adorsys/keycloak/config/repository/StateRepository.java b/src/main/java/de/adorsys/keycloak/config/repository/StateRepository.java
index bb1d1e3c..c0327e4f 100644
--- a/src/main/java/de/adorsys/keycloak/config/repository/StateRepository.java
+++ b/src/main/java/de/adorsys/keycloak/config/repository/StateRepository.java
@@ -85,12 +85,22 @@ public class StateRepository {
             return;
         }
 
+        // preserve custom attributes which do not contain realm state
+        attributes.entrySet()
+                .stream()
+                .filter(e -> !isStateAttribute(e))
+                .forEach(e -> customAttributes.put(e.getKey(), e.getValue()));
+
         customAttributes.entrySet()
                 .stream()
-                .filter(e -> e.getKey().startsWith(ImportConfigProperties.REALM_STATE_ATTRIBUTE_COMMON_PREFIX))
+                .filter(this::isStateAttribute)
                 .forEach(e -> attributes.put(e.getKey(), e.getValue()));
     }
 
+    private boolean isStateAttribute(Map.Entry<String, String> e) {
+        return e.getKey().startsWith(ImportConfigProperties.REALM_STATE_ATTRIBUTE_COMMON_PREFIX);
+    }
+
     public List<String> getState(String entity) {
         List<String> stateValues = new ArrayList<>();
 
diff --git a/src/test/java/de/adorsys/keycloak/config/service/ImportClientsIT.java b/src/test/java/de/adorsys/keycloak/config/service/ImportClientsIT.java
index 60b0eeaf..7aef6ade 100644
--- a/src/test/java/de/adorsys/keycloak/config/service/ImportClientsIT.java
+++ b/src/test/java/de/adorsys/keycloak/config/service/ImportClientsIT.java
@@ -65,6 +65,10 @@ class ImportClientsIT extends AbstractImportTest {
         assertThat(realm.getRealm(), is(REALM_NAME));
         assertThat(realm.isEnabled(), is(true));
 
+        // ... initial version of a custom attribute is in place
+        assertThat(realm.getAttributes(), not(anEmptyMap()));
+        assertThat(realm.getAttributes().get("custom"), is("test-step00"));
+
         ClientRepresentation createdClient = getClientByClientId(realm, "moped-client");
 
         assertThat(createdClient, notNullValue());
@@ -104,6 +108,10 @@ class ImportClientsIT extends AbstractImportTest {
         assertThat(realm.getRealm(), is(REALM_NAME));
         assertThat(realm.isEnabled(), is(true));
 
+        // ... updated version of a custom attribute is in place
+        assertThat(realm.getAttributes(), not(anEmptyMap()));
+        assertThat(realm.getAttributes().get("custom"), is("test-step01"));
+
         ClientRepresentation client;
         String clientSecret;
 
diff --git a/src/test/resources/import-files/clients/00_create_realm_with_client.json b/src/test/resources/import-files/clients/00_create_realm_with_client.json
index 8a26e5f9..5154d687 100644
--- a/src/test/resources/import-files/clients/00_create_realm_with_client.json
+++ b/src/test/resources/import-files/clients/00_create_realm_with_client.json
@@ -32,6 +32,6 @@
     }
   ],
   "attributes": {
-    "custom": "test"
+    "custom": "test-step00"
   }
 }
diff --git a/src/test/resources/import-files/clients/01_update_realm__add_client.json b/src/test/resources/import-files/clients/01_update_realm__add_client.json
index 677fbfc0..aff51596 100644
--- a/src/test/resources/import-files/clients/01_update_realm__add_client.json
+++ b/src/test/resources/import-files/clients/01_update_realm__add_client.json
@@ -57,6 +57,6 @@
     }
   ],
   "attributes": {
-    "custom": "test"
+    "custom": "test-step01"
   }
 }
['src/test/resources/import-files/clients/01_update_realm__add_client.json', 'src/main/java/de/adorsys/keycloak/config/repository/StateRepository.java', 'CHANGELOG.md', 'src/test/resources/import-files/clients/00_create_realm_with_client.json', 'src/test/java/de/adorsys/keycloak/config/service/ImportClientsIT.java']