anchor.diff:                              {reason, "unknown event id"}]}
       end,
       {Res, S};
  -%% http://idrott/idrott/create_event?sid=1234567890&name=foo&date=2014-10-01&pm=foo&timeschedule=foo&location=vallen&funcinfo=foo&funccount=10&funccall=open
  -do_cmd("create_event", L0, Json, S) ->
  -    Sid = get_val("sid", L0, ""),
  +%% http://idrott/idrott/create_event?sid=1234567890
  +do_cmd("create_event", L, Json, S) ->
  +    Sid = get_val("sid", L, ""),
       case get_user_by_id(Sid, S) of
           U=#user{} when U#user.role == admin ->
  -            L = case Json of
  -                     {struct, Ops} ->  L0 ++ Ops;
  -                     _ -> L0
  -                 end,
               %% login successful
               {S2, Id} = new_event_id(S),
  -            Event = apply_event_ops(#event{id=Id}, L),
  +            Event = apply_event_json(#event{id=Id}, Json),
               NewS = S2#state{events=[Event|S2#state.events]},
               Res = {struct, [{status, "ok"},
                               {event, event2object(Event)}]};
  
positive.code: 
  new_event_id(S) ->
      Id = S#state.event_id+1,
      case get_event_by_id(S, Id) of
          false ->
              {S#state{event_id=Id}, Id};
          _ ->
  
negative.code:     apply_event_ops(E, Ops).
  
  apply_event_json(E, {struct, Ops}) ->
      apply_event_ops(E, Ops).
  
  %%
  
  