anchor.diff:  %% Generates uuid if needed.
   %% @end
   %%--------------------------------------------------------------------
  --spec fill_uuid(doc()) -> doc().
  -fill_uuid(Doc = #document{key = undefined}) ->
  +-spec fill_uuid(doc(), doc()) -> doc().
  +fill_uuid(Doc = #document{key = undefined, value = #file_meta{is_scope = true}}, _ParentUuid) ->
       NewUuid = datastore_utils:gen_key(),
       Doc#document{key = NewUuid};
  -fill_uuid(Doc) ->
  +%%fill_uuid(Doc = #document{key = undefined, value = #file_meta{type = ?DIRECTORY_TYPE}}, _ParentUuid) ->
  +%%    NewUuid = datastore_utils:gen_key(),
  +%%    Doc#document{key = NewUuid};
  +fill_uuid(Doc = #document{key = undefined}, ParentUuid) ->
  +    LabelSize = consistent_hashing:get_label_gen_size(),
  +    LabelPart = binary:part(ParentUuid, 0, LabelSize),
  +    NewUuid = case LabelPart of
  +        <<"space_">> ->
  +            % TODO - wylosowac ale na tym samym node!
  +%%            ?info("aaaaa2 ~p", [{Doc, true}]),
  +            datastore_utils:gen_key();
  +        _ ->
  +            GenPart = datastore_utils:gen_short_key(LabelSize),
  +            <<LabelPart/binary, GenPart/binary>>
  +    end,
  +    Doc#document{key = NewUuid};
  +fill_uuid(Doc, _ParentUuid) ->
       Doc.
   
   %%--------------------------------------------------------------------
  
positive.code: }}) ->
      ?run(begin
          true = is_valid_filename(FileName),
  %%        ?info("hhhhh ~p", [ParentUuid]),
          {ok, ParentDoc} = file_meta:get(ParentUuid),
          FileDoc2 = #document{key = FileUuid} = fill_uuid(FileDoc),
          SpaceDirUuid = case IsScope of
              true ->
                  FileDoc2#document.key;
  
negative.code: save(#document{value = #file_meta{is_scope = true}} = Doc, _GeneratedKey) ->
      Ctx = ?CTX,
      ?extract_key(datastore_model:save(Ctx#{memory_copies => all}, Doc));
  save(Doc, GeneratedKey) ->
      ?extract_key(datastore_model:save(?CTX#{generated_key => GeneratedKey}, Doc)).
  
  