code: public static UIContext getPrimaryUIContext(final UIContext uic) {
  		if (uic == null) {
  			return null;
  		}
  
  		UIContext primary = null;
  		UIContext current = uic;
  
  		while (primary == null) {
  			if (current instanceof UIContextDelegate) {
  				UIContext backing = ((UIContextDelegate) current).getBacking();
  				if (backing != null) {
  					current = backing;
  				} else {
  					// This case should probably never happen.
  					primary = current;
  					LOG.warn("UIContextDelegate found without a backing context");
  				}
  			} else {
  				primary = current;
  			}
  		}
  
  		return primary;
  	}
docs: A utility function to iterate to the primary (top most) context and return it.
  
  @param uic the UIContext to retrieve the primary context for.
  @return the primary context for the given context.