public static Module createPreviewModule(Project project, VirtualFile contentRoot) {
    return WriteAction.compute(() -> {
      Path modulePath = contentRoot.toNioPath().resolve(project.getName() + ModuleFileType.DOT_DEFAULT_EXTENSION);
      Module module = ModuleManager.getInstance(project)
        .newModule(modulePath, ModuleTypeManager.getInstance().getDefaultModuleType().getId());
      ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(module).getModifiableModel();
      modifiableModel.addContentEntry(contentRoot);
      modifiableModel.commit();

      ExternalSystemUtil.markModuleAsMaven(module, null, true);

      return module;
    });
  }
public static Module createPreviewModule(Project project, VirtualFile contentRoot)