anchor.diff:                        #{}, L),
       maps:to_list(Map).
   
  -
   %%
   %%
   make_sql_callback() ->
       fun chef_sql:select_rows/1.
   
  -
   %%
   %% Helper function for working with unscoped names
   %%
  +-spec make_scoped_names(binary(), [binary()]) -> [{binary(), binary()}].
   make_scoped_names(OrgName, Names) ->
       [{OrgName, Name} || Name <- Names].
  -
  -%%
  -%%
  -%%
  -fetch_authz_ids(Type, ScopedNames) ->
  -    NamesByOrg = group_by_key(ScopedNames),
  -    case fetch_ids_rec(Type, NamesByOrg, {[], []}) of
  -        [Found, []] ->
  -            Found;
  -        [_, Missing] ->
  -            throw({invalid, Type, Missing})
  -    end.
  -
  -
  -%%
  -%%
  -%%
  -fetch_ids_rec(_type, [], {Found, Missing}) ->
  -    {lists:flatten(Found), Missing};
  -fetch_ids_rec(Type, [{OrgId, Names} | Remainder], {Found, Missing}) ->
  -    Records = oc_chef_authz_db:authz_records_by_name(Type, OrgId, Names),
  -    FoundNames = lists:sort(names_from_records(Records)), % Investigate if this sort is redundant (db may already sort)
  -    Remaining = Names -- FoundNames, % --/++ on very large lists might be slow.
  -    Missing1 = case Remaining of
  -                  [] ->
  -                      [{OrgId, Remaining} | Missing];
  -                  _ ->
  -                      Missing
  -              end,
  -    fetch_ids_rec(Type, Remainder, {[FoundNames | Found], Missing1}).
  -
   
   %%
   %% Expansion of authz ids into scoped names
   %% Takes {OrgName, Name} pairs in ScopedNames and returns
   %% list of names with scoping metacharacter inserted
  +-spec render_names_in_context(binary(),[{binary(), [binary()]}], #context{}) -> [binary()].
   render_names_in_context(OrgId, ScopedNames, Context) ->
       GroupedScopedNames = group_by_key(ScopedNames),
       {Expanded, _Cache} = lists:foldl(fun(E, A) -> render_names_in_context_f(OrgId, E, A) end,
  
positive.code:          org_id_to_name/1
          ]).
  
  -export([parse_scoped_name/3, fetch_authz_ids/2]).
  
  -ifdef(TEST).
  -compile([export_all]).
  
negative.code: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %% Support routines
  %%
  -spec is_scoped_type(lookup_type()) -> boolean().
  is_scoped_type(group) ->
      true;
  is_scoped_type(_) ->
  