anchor.diff:              SpaceId = file_id:guid_to_space_id(Guid),
               op_logic_utils:assert_space_supported_locally(SpaceId)
       end.
  +
  +
  +%% @private
  +-spec create_file(
  +    SessionId :: session:id(),
  +    ParentGuid :: file_id:file_guid(),
  +    Name :: file_meta:name(),
  +    Mode :: undefined | file_meta:mode(),
  +    Type :: file | dir,
  +    Counter :: non_neg_integer(),
  +    Retries :: non_neg_integer()
  +) ->
  +    {ok, file_id:file_guid()} | no_return().
  +create_file(SessId, ParentGuid, Name, Mode, Type, Counter, Counter) ->
  +    ?check(create_file(SessId, ParentGuid, Name, Mode, Type));
  +create_file(SessId, ParentGuid, OriginalName, Mode, Type, Counter, Retries) ->
  +    Name = case Counter of
  +        0 ->
  +            OriginalName;
  +        _ ->
  +            RootName = filename:rootname(OriginalName),
  +            Ext = filename:extension(OriginalName),
  +            str_utils:format_bin("~s(~B)~s", [RootName, Counter, Ext])
  +    end,
  +    case create_file(SessId, ParentGuid, Name, Mode, Type) of
  +        {ok, Guid} ->
  +            {ok, Guid};
  +        {error, ?EEXIST} ->
  +            create_file(
  +                SessId, ParentGuid, OriginalName, Mode, Type,
  +                Counter + 1, Retries
  +            );
  +        {error, Errno} ->
  +            throw(?ERROR_POSIX(Errno))
  +    end.
  +
  +
  +%% @private
  +-spec create_file(
  +    SessionId :: session:id(),
  +    ParentGuid :: file_id:file_guid(),
  +    Name :: file_meta:name(),
  +    Mode :: undefined | file_meta:mode(),
  +    Type :: file | dir
  +) ->
  +    {ok, file_id:file_guid()} | {error, term()}.
  +create_file(SessionId, ParentGuid, Name, Mode, file) ->
  +    lfm:create(SessionId, ParentGuid, Name, Mode);
  +create_file(SessionId, ParentGuid, Name, Mode, dir) ->
  +    lfm:mkdir(SessionId, ParentGuid, Name, Mode).
   
   
   %%--------------------------------------------------------------------
  
positive.code: -include("op_logic.hrl").
  -include("modules/logical_file_manager/lfm.hrl").
  -include_lib("ctool/include/api_errors.hrl").
  
  -export([op_logic_plugin/0]).
  -export([
  
negative.code: create(#op_req{auth = Auth, data = Data, gri = #gri{aspect = instance} = GRI}) ->
      SessionId = Auth#auth.session_id,
  
      {ok, Guid} = create_file(
          SessionId,
          maps:get(<<"parent">>, Data),
          maps:get(<<"name">>, Data),
          undefined,
          binary_to_atom(maps:get(<<"type">>, Data), utf8),
          0,
          maps:get(<<"createAttempts">>, Data, 1) - 1
      ),
  
      {ok, Attrs} = ?check(lfm:stat(SessionId, {guid, Guid})),
      {ok, resource, {GRI#gri{id = Guid}, Attrs}};
  