anchor.diff:      {ok, uuid()} | datastore:create_error().
   create({uuid, ParentUuid}, FileDoc = #document{
       value = FileMeta = #file_meta{
  -        name = FileName
  +        name = FileName,
  +        is_scope = IsScope
       }
  -}, AllowConflicts, ScopeId) ->
  -    ?run(begin
  +}, AllowConflicts) ->
  +    ?run(begin
  +        true = is_valid_filename(FileName),
           {ok, ParentDoc} = get(ParentUuid),
  -        {ok, Scope} = get_scope(ParentDoc),
  -        NewFileMeta = FileMeta#file_meta{scope = Scope#document.key,
  -            provider_id = oneprovider:get_provider_id(), parent_uuid = ParentUuid},
  -        FileDoc2 =
  -            case FileDoc of
  -                #document{key = undefined} = Doc ->
  -                    NewUuid = gen_file_uuid(),
  -                    Doc#document{key = NewUuid, value = NewFileMeta};
  -                _ ->
  -                    FileDoc#document{value = NewFileMeta}
  -            end,
  -        {ok, DocScope} = get_scope(FileDoc2),
  -        ScopeId = fslogic_uuid:space_dir_uuid_to_spaceid_no_error(DocScope#document.key),
  -        FileDoc3 = FileDoc2#document{value = NewFileMeta, scope = ScopeId},
  +
  +        FileDoc2 = fill_uuid(FileDoc),
  +        FileDoc3 = case IsScope of
  +            true ->
  +                SpaceDirUuid = FileDoc2#document.key,
  +                SpaceId = fslogic_uuid:space_dir_uuid_to_spaceid_no_error(SpaceDirUuid),
  +                FileDoc2#document{
  +                    scope = SpaceId,
  +                    value = FileMeta#file_meta{
  +                        scope = SpaceDirUuid,
  +                        provider_id = oneprovider:get_provider_id(),
  +                        parent_uuid = ParentUuid
  +                    }};
  +            false ->
  +                {ok, ScopeId} = get_scope_id(ParentDoc),
  +                SpaceDirUuid = ScopeId,
  +                SpaceId = fslogic_uuid:space_dir_uuid_to_spaceid_no_error(SpaceDirUuid),
  +                FileDoc2#document{
  +                    scope = SpaceId,
  +                    value = FileMeta#file_meta{
  +                        scope = SpaceDirUuid,
  +                        provider_id = oneprovider:get_provider_id(),
  +                        parent_uuid = ParentUuid
  +                    }
  +                }
  +        end,
           critical_section:run([?MODEL_NAME, ParentUuid],
               fun() ->
                   Exists = case AllowConflicts of
  
positive.code: %%--------------------------------------------------------------------
  %% @private
  %% @doc
  %% Fixes links to given document in its parent. Also fixes 'parent' link.
  %% @end
  %%--------------------------------------------------------------------
  
negative.code:             parent_uuid = ParentUuidInDoc
          }
      }} = get(Entry),
      {ok, ScopeId} = get_scope_id(Parent),
      ok = model:execute_with_default_context(?MODULE, set_links,
          [ParentDoc, {FileName, FileDoc}]),
      ok = set_scope(FileDoc, ScopeId),
      case ParentUuidInDoc =/= ParentUuid of
          true ->
              update(FileUuid, #{parent_uuid => ParentUuid});
  