anchor.diff:                        Map
                 end,
       SortedKeys = lists:sort(maps:keys(Batches)),
  +
  +    % check if we have all needed changes to start batches application
       Stashed = lists:foldl(fun(S, Acc) ->
           case Acc + 1 >= S of
               true ->
  
positive.code: %%--------------------------------------------------------------------
  -spec state_put(Key :: term(), Value :: term()) -> ok.
  state_put(Key, Value) ->
      {ok, _} = dbsync_state:save(#document{key = {dbsync_state, Key}, value = #dbsync_state{entry = Value}}),
      ok.
  
  %%--------------------------------------------------------------------
  
negative.code:                     ?error("Unable to find space id for document ~p due to: ~p", [Doc, Reason]),
                      {error, Reason}
              end,
              case Model of
                  dbsync_state ->
                      ok;
                  _ ->
                      queue_update_until(QueueKey, Seq)
  