anchor.diff:  %%--------------------------------------------------------------------
   %% @private
   %% @doc
  -%% Gets head of the list.
  -%% @end
  -%%--------------------------------------------------------------------
  --spec hd(term()) -> term().
  -hd(List) when is_list(List) ->
  -    erlang:hd(List);
  -hd(Term) ->
  +%% Gets head of the list if term is list or return term.
  +%% @end
  +%%--------------------------------------------------------------------
  +-spec hd_if_list(term()) -> term().
  +hd_if_list(List) when is_list(List) ->
  +    hd(List);
  +hd_if_list(Term) ->
       Term.
positive.code: get_links(Ctx, Key, TreeIds, LinkNames) when is_list(LinkNames) ->
      datastore_apply(Ctx, Key, fun datastore:get_links/4, get_links, [TreeIds, LinkNames]);
  get_links(Ctx, Key, TreeIds, LinkName) ->
      ?MODULE:hd(get_links(Ctx, Key, TreeIds, [LinkName])).
  
  %%--------------------------------------------------------------------
  %% @doc
  
negative.code: add_links(Ctx, Key, TreeId, Links) when is_list(Links) ->
      datastore_apply(Ctx, Key, fun datastore:add_links/4, add_links, [TreeId, Links]);
  add_links(Ctx, Key, TreeId, Link) ->
      hd_if_list(add_links(Ctx, Key, TreeId, [Link])).
  
  %%--------------------------------------------------------------------
  %% @doc
  