private static Path getOutputModuleFile(CommandLine line) throws IOException {

    if (!line.hasOption(OUTPUT_MODEL)) {
      return null;
    }

    String outputPathName = line.getOptionValue(OUTPUT_MODEL);

    Path outputPath = Paths.get(outputPathName);

    if (!Files.exists(outputPath)) {
      Files.createDirectories(outputPath);
    }

    if (Files.isDirectory(outputPath) && Files.isWritable(outputPath)) {
      return outputPath;
    } else {
      System.err.println("Output directory option should be a writable directory");
      System.exit(1);
      return null;
    }
  }