anchor.diff:  handle_cast(_Msg, State) ->
       {noreply, State}.
   
  +handle_info({mnesia_table_event, {delete, {Tab, Key}, _Id}}, State) ->
  +    handle_delete(Tab, Key),
  +    {noreply, State};
   handle_info(trim_tables, State) ->
       [trim_rxframes(R) || R <- mnesia:dirty_all_keys(links)],
       [mnesia:dirty_delete(events, E) || E <- expired_events()],
  +    {noreply, State};
  +handle_info(_Other, State) ->
       {noreply, State}.
   
   terminate(_Reason, _State) ->
  
positive.code: code_change(_OldVsn, State, _Extra) ->
      {ok, State}.
  
  
  trim_rxframes(DevAddr) ->
      {ok, Count} = application:get_env(lorawan_server, retained_rxframes),
  
negative.code:     gen_server:start_link(?MODULE, [], []).
  
  init([]) ->
      {ok, _} = mnesia:subscribe({table, links, simple}),
      {ok, _} = timer:send_interval(3600*1000, trim_tables),
      {ok, undefined}.
  
  