public static void createProperty(@NotNull Project project,
                                    @NotNull Collection<? extends PropertiesFile> propertiesFiles,
                                    @NotNull String key,
                                    @NotNull String value,
                                    boolean replaceIfExist) throws IncorrectOperationException {
    for (PropertiesFile file : propertiesFiles) {
      PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
      Document document = documentManager.getDocument(file.getContainingFile());
      if (document != null) {
        documentManager.commitDocument(document);
      }

      IProperty existingProperty = file.findPropertyByKey(key);
      if (existingProperty == null) {
        file.addProperty(key, value, PropertyKeyValueFormat.MEMORY);
      }
      else if (replaceIfExist) {
        existingProperty.setValue(value, PropertyKeyValueFormat.MEMORY);
      }
    }
  }
public static void createProperty(@NotNull Project project,
                                    @NotNull Collection<? extends PropertiesFile> propertiesFiles,
                                    @NotNull String key,
                                    @NotNull String value,
                                    boolean replaceIfExist)