public VelocityContext getVelocityContext(Map<String, Object> modelMap, Class<? extends SparkController> controller, String viewName) {
HashMap<String, Object> context = new HashMap<>(modelMap);
context.put("railsAssetsService", railsAssetsService);
context.put("webpackAssetsService", webpackAssetsService);
context.put("securityService", securityService);
context.put("maintenanceModeService", maintenanceModeService);
context.put("currentUser", SessionUtils.currentUsername());
context.put("controllerName", humanizedControllerName(controller));
context.put("viewName", viewName);
context.put("currentVersion", CurrentGoCDVersion.getInstance());
context.put("toggles", Toggles.class);
context.put("goUpdate", versionInfoService.getGoUpdate());
context.put("goUpdateCheckEnabled", versionInfoService.isGOUpdateCheckEnabled());
context.put("serverTimezoneUTCOffset", TimeZone.getDefault().getOffset(new Date().getTime()));
context.put("spaRefreshInterval", SystemEnvironment.goSpaRefreshInterval());
context.put("spaTimeout", SystemEnvironment.goSpaTimeout());
context.put("showAnalyticsDashboard", showAnalyticsDashboard());
context.put("devMode", !new SystemEnvironment().useCompressedJs());
return new VelocityContext(context);
}