anchor.diff:              {ok, BatchesRecord#dbsync_batches{batches = NewBatches}}
           end),
       ok.
  -%%    state_update({stash, ProviderId, SpaceId},
  -%%        fun
  -%%            (undefined) ->
  -%%                #{};
  -%%            (Batches) ->
  -%%                #batch{until = Until} = maps:get(NewSince, Batches, #batch{until = 0}),
  -%%                case NewUntil >= Until of
  -%%                    true ->
  -%%                        maps:remove(NewSince, Batches);
  -%%                    false ->
  -%%                        Batches
  -%%                end
  -%%        end).
   
   
   %%--------------------------------------------------------------------
  
positive.code:             end
          end),
      ok.
  %%    state_update({stash, ProviderId, SpaceId},
  %%        fun
  %%            (undefined) ->
  %%                maps:put(NewSince, Batch, #{});
  %%            (Batches) ->
  %%                case (CurrentUntil + 1 < NewSince) andalso (size(term_to_binary(Batches)) > ?CHANGES_STASH_MAX_SIZE_BYTES) of
  %%                    true -> Batches;
  %%                    false ->
  %%                        #batch{until = Until} = maps:get(NewSince, Batches, #batch{until = 0}),
  %%                        case NewUntil > Until of
  %%                            true ->
  %%                                maps:put(NewSince, Batch, Batches);
  %%                            false ->
  %%                                Batches
  %%                        end
  %%                end
  %%        end).
  
  %%--------------------------------------------------------------------
  %% @doc
  
negative.code:                 ok ->
                      timer:sleep(timer:seconds(2)),
                      Batches = get_stashed_batches(ProviderId, SpaceId),
                      SortedKeys = lists:sort(maps:keys(Batches)),
                      Stashed = lists:foldl(fun(S, Acc) ->
                          case Acc + 1 >= S of
  