public static IResourceGroup GetOrAddGroup(this IResourceCache resourceCache, string consolidatedUrl, Func <IResourceGroup> getGroup) { IResourceGroup group; if (resourceCache.TryGetGroup(consolidatedUrl, out group)) { return(group); } group = getGroup(); if (group != null) { resourceCache.StoreGroup(consolidatedUrl, group); } return(group); }