anchor.diff:  }}) ->
       ?run(begin
           true = is_valid_filename(FileName),
  -%%        ?info("hhhhh ~p", [ParentUuid]),
           {ok, ParentDoc} = file_meta:get(ParentUuid),
  -        FileDoc2 = #document{key = FileUuid} = fill_uuid(FileDoc),
  +        FileDoc2 = #document{key = FileUuid} = fill_uuid(FileDoc, ParentUuid),
           SpaceDirUuid = case IsScope of
               true ->
                   FileDoc2#document.key;
  
positive.code: %% Generates uuid if needed.
  %% @end
  %%--------------------------------------------------------------------
  -spec fill_uuid(doc()) -> doc().
  fill_uuid(Doc = #document{key = undefined}) ->
      NewUuid = datastore_utils:gen_key(),
      Doc#document{key = NewUuid};
  fill_uuid(Doc) ->
      Doc.
  
  %%--------------------------------------------------------------------
  
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)).
  
  