public static @NotNull FileTemplate createTemplate(@NotNull String prefName,
                                                     @NotNull String extension,
                                                     @NotNull String content,
                                                     @NotNull List<? extends FileTemplate> templates) {
    final Set<String> names = new HashSet<>();
    for (FileTemplate template : templates) {
      names.add(template.getName());
    }
    String name = prefName;
    int i = 0;
    while (names.contains(name)) {
      name = prefName + " (" + ++i + ")";
    }
    final FileTemplate newTemplate = new CustomFileTemplate(name, extension);
    newTemplate.setText(content);
    return newTemplate;
  }
public static @NotNull FileTemplate createTemplate(@NotNull String prefName,
                                                     @NotNull String extension,
                                                     @NotNull String content,
                                                     @NotNull List<? extends FileTemplate> templates)