/** Returns the current context in the given config */
 public static Context getCurrentContext(Config config) {
   String contextName = config.getCurrentContext();
   if (contextName != null) {
     List<NamedContext> contexts = config.getContexts();
     if (contexts != null) {
       for (NamedContext context : contexts) {
         if (contextName.equals(context.getName())) {
           return context.getContext();
         }
       }
     }
   }
   return null;
 }