class MenuUtils {

    public static MenuBar buildMenuBar() {
        ClassLoader classLoader = ClassLoader.getSystemClassLoader();
        String licenseFileAsString = loadLicenseFileAsString(classLoader);

        @Nullable
        Optional<String> versionNumber = VersionInfo.findVersionInfo(VersionInfo.artifactId, false);

        MenuItem licenseMenuItem = new MenuItem(licenseFileAsString);

        Menu versionMenu = new Menu(versionNumber.map(value -> "GazePlay " + value).orElse("GazePlay unreleased version"));
        versionMenu.getItems().add(licenseMenuItem);

        String username = ActiveConfigurationContext.getInstance().getUserName();
        Menu profileMenu = new Menu("Current Profile: " + (username.isEmpty() ? "Default" : username));

        MenuBar menuBar = new MenuBar();
        menuBar.getMenus().addAll(versionMenu, profileMenu);
        menuBar.setPrefHeight(40);
        menuBar.setPrefWidth(80);

        return menuBar;
    }

}