anchor.diff:  %% Executes given function for each link of the document given by key - similar to 'foldl'.
   %% @end
   %%--------------------------------------------------------------------
  --spec foreach_link(opt_ctx(), Key :: ext_key(),
  +-spec foreach_link(opt_ctx(), ext_key() | document(),
       fun((link_name(), link_target(), Acc :: term()) -> Acc :: term()), AccIn :: term()) ->
       {ok, Acc :: term()} | link_error().
  +foreach_link(Ctx, #document{key = Key}, Fun, AccIn) ->
  +    foreach_link(Ctx, Key, Fun, AccIn);
   foreach_link(Ctx, Key, Fun, AccIn) ->
       exec_driver(Ctx, foreach_link, [Key, Fun, AccIn]).
   
  
positive.code: %% Sets given links to the document with given key.
  %% @end
  %%--------------------------------------------------------------------
  -spec set_links(opt_ctx(), ext_key(), link_spec() | [link_spec()]) ->
      ok | generic_error().
  set_links(Ctx, Key, {_LinkName, _LinkTarget} = LinkSpec) ->
      set_links(Ctx, Key, [LinkSpec]);
  set_links(Ctx, Key, Links) when is_list(Links) ->
  
negative.code: %% Adds given links to the document with given key. Allows for link duplication when model is configured this way.
  %% @end
  %%--------------------------------------------------------------------
  -spec add_links(opt_ctx(), ext_key() | document(), link_spec() | [link_spec()]) ->
      ok | generic_error().
  add_links(Ctx, #document{key = Key}, Links) ->
      add_links(Ctx, Key, Links);
  add_links(Ctx, Key, {_LinkName, _LinkTarget} = LinkSpec) ->
      add_links(Ctx, Key, [LinkSpec]);
  add_links(Ctx, Key, Links) when is_list(Links) ->
  