T GetInheritedPolicy(IEnumerable <string> scopes)
 {
     foreach (string scope in scopes)
     {
         PolicyContainer currentBag = scope == mimeType ? policyContainer.ParentPolicies : policyContainer;
         while (currentBag != null)
         {
             if (currentBag.DirectHas <T> (scope))
             {
                 T pol = currentBag.DirectGet <T> (scope);
                 if (pol != null)
                 {
                     return(pol);
                 }
                 // Default settings requested for this scope. Start looking from the original
                 // bag now using the next scope in the chain
                 break;
             }
             else
             {
                 currentBag = currentBag.ParentPolicies;
             }
         }
     }
     return(PolicyService.GetDefaultPolicy <T>(scopes));
 }
        T GetDirectInherited(PolicyContainer initialContainer)
        {
            if (initialContainer == policyContainer && !loaded && hasCachedPolicy)
            {
                return((T)cachedPolicy);
            }
            PolicyContainer pc = initialContainer;

            while (pc != null)
            {
                if (pc.DirectHas <T> (mimeType))
                {
                    return(pc.DirectGet <T> (mimeType));
                }
                pc = pc.ParentPolicies;
            }
            return(PolicyService.GetUserDefaultPolicySet().Get <T> (mimeType));
        }