anchor.diff:      SesPids = dict:to_list(State#session_srv.pid2key),
       lists:foreach(fun({Pid,Key}) -> io:format("sid:~p~n", [Key]), z_session:dump(Pid) end, SesPids),
       {reply, ok, State};
  +
  +%% Call Function on successive sessions together with an extra argument Acc (short for accumulator).
  +%% Fun must return a new accumulator which is passed to the next call.
  +%% Acc0 is returned if no sessions exist.
  +handle_call({fold, Function, Acc0}, From,
  +	    #session_srv{context=Context, pid2key=Pid2Key} = State) ->
  +    SesPids = dict:fetch_keys(Pid2Key),
  +    if
  +	is_function(Function, 2) ->
  +	    spawn(fun() ->
  +			  Res = lists:foldl(Function, Acc0, SesPids),
  +			  gen_server:reply(From, Res)
  +		  end);
  +	is_function(Function, 3) ->
  +	    spawn(fun() ->
  +			  Res = lists:foldl(fun(Pid, Acc) -> Function(Pid, Context#context{session_pid=Pid}, Acc) end, Acc0, SesPids),
  +			  gen_server:reply(From, Res)
  +		  end)
  +    end,
  +    {noreply, State};    
       
   handle_call(Msg, _From, State) ->
       {stop, {unknown_call, Msg}, State}.
  
positive.code: foreach(Function, SessionManager) when is_function(Function) ->
      gen_server:cast(SessionManager, {foreach, Function}).
  
  %% @spec broadcast(#broadcast{}, Context) -> ok
  %% @doc Broadcast a notification message to all open sessions.
  broadcast(#broadcast{title=Title, message=Message, is_html=IsHtml, type=Type, stay=Stay}, Context) ->
  
negative.code:     get_session_id/1,
      tick/1,
      foreach/2,
      broadcast/2,
      fold/3
  ]).
  
  -include_lib("zotonic.hrl").
  