anchor.diff:      ?Error([{user, User}], "~p received unknown msg ~p for ~p", [?MODULE, Info, User]),
       {noreply, State}.
   
  -terminate(Reason, #state{user=User}) ->
  +terminate(Reason, #state{user = User, adapt_priv = AdaptPriv}) ->
  +    logout(AdaptPriv),
       ?Info([{user, User}], "~p terminating ~p session for ~p", [?MODULE, {self(), User}, Reason]).
   
   code_change(_OldVsn, State, _Extra) -> {ok, State}.
  
positive.code:     ?Error([{user, _User}], "~p received unknown cast ~p for ~p", [_Unknown, _User]),
      {noreply, State}.
  
  handle_info(die, #state{user=_User, adapt_priv = AdaptPriv}=State) ->
      ?Error([{user, _User}], "terminating session idle for ~p ms", [?SESSION_IDLE_TIMEOUT]),
      logout(AdaptPriv),
      {stop, timeout, State#state{adapt_priv = []}};
  handle_info(logout, #state{user = User} = State) ->
      ?Debug("terminating session of logged out user ~p", [User]),
      {stop, normal, State};
  
negative.code: 
  
  % commands handled generically
  process_call({[C], ReqData}, _Adapter, From, #state{} = State) when
        C =:= <<"parse_stmt">>;
        C =:= <<"get_query">>;
        C =:= <<"save_view">> ->
      BodyJson = jsx:decode(ReqData),
      gen_adapter:process_cmd({[C], BodyJson}, From, undefined),
      State;
  
  process_call({Cmd, ReqData}, Adapter, From, #state{adapt_priv = AdaptPriv} = State) ->
  