class VersionServiceImpl implements VersionService {

    @Override
    public Path restore(final Path _path,
                        final String comment,
                        final String branchName) {
        try {
            ioService.startBatch(Paths.convert(_path).getFileSystem());

            final org.uberfire.java.nio.file.Path path = pathResolver.resolveMainFilePath(convert(_path));
            final org.uberfire.java.nio.file.Path target = versionUtil.getPath(path, branchName);

            return convert(ioService.copy(path,
                                          target,
                                          REPLACE_EXISTING,
                                          new CommentedOption(
                                                  sessionInfo != null ? sessionInfo.getId() : "--",
                                                  sessionInfo != null ? sessionInfo.getIdentity().getIdentifier() : "system",
                                                  null,
                                                  comment)));
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            ioService.endBatch();
        }
    }

}