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:                     ?error("Unable to find space id for document ~p due to: ~p", [Doc, Reason]),
                      {error, Reason}
              end,
              case Key of
                  {dbsync_state, _} ->
                      ok;
                  _ ->
                      queue_update_until(QueueKey, Seq)
  
negative.code:     end, CurrentUntil, SortedKeys),
      case Stashed + 1 < NewBranchSince of
          true ->
              % missing batches - check once more (requests may be processed in parallel) and request missing changes
              timer:sleep(timer:seconds(2)),
              NewCurrentUntil = get_current_seq(ProviderId, SpaceId),
              case NewCurrentUntil > CurrentUntil of
  