anchor.diff:  %% parsing or returns an error. Returns list of parsed filed values and
   %% file body.
   %% @end
  --spec handle_upload_request(Req :: req(), record()) -> 
  +-spec handle_upload_request(Req :: req(), record()) ->
       {ok, Params :: [tuple()], Files :: [#uploaded_file{}]} |
       {error, incorrect_session}.
   %% ====================================================================
   handle_upload_request(Req, UserDoc) ->
       case UserDoc of
  -        undefined -> 
  +        undefined ->
               {error, incorrect_session};
  -        Doc -> 
  +        Doc ->
               case user_logic:get_dn_list(Doc) of
  -                [] -> 
  +                [] ->
                       {error, incorrect_session};
  -                undefined -> 
  +                undefined ->
                       {error, incorrect_session};
                   List when is_list(List) ->
                       % This will cause logical_files_manager to create the file for proper user
  
positive.code: 
  ensure_unique_filename(RequestedPath, Counter) ->
      Ext = filename:extension(RequestedPath),
      Rootname = filename:rootname(RequestedPath), 
      NewName = lists:flatten(io_lib:format("~s(~B)~s", [Rootname, Counter, Ext])),
      case logical_files_manager:create(NewName) of
          ok -> NewName;
  
negative.code: %% <em>{body, Data}</em> tuples and finally <em>end_of_part</em>. When there
  %% is no part to parse anymore, <em>eof</em> is returned.
  -spec multipart_data(Req)
              -> {headers, cowboy:http_headers(), Req} | {body, binary(), Req}
          | {end_of_part | eof, Req} when Req :: req().
  multipart_data(Req = #http_req{body_state = waiting}) ->
      {ok, {<<"multipart">>, _SubType, Params}, Req2} =
          cowboy_req:parse_header(<<"content-type">>, Req),
      {_, Boundary} = lists:keyfind(<<"boundary">>, 1, Params),
      {ok, Length, Req3} = cowboy_req:parse_header(<<"content-length">>, Req2),
      multipart_data(Req3, Length, {more, cowboy_multipart:parser(Boundary)});
  multipart_data(Req = #http_req{multipart = {Length, Cont}}) ->
      multipart_data(Req, Length, Cont());
  multipart_data(Req = #http_req{body_state = done}) ->
      {eof, Req}.
  
  multipart_data(Req, Length, {headers, Headers, Cont}) ->
      {headers, Headers, Req#http_req{multipart = {Length, Cont}}};
  multipart_data(Req, Length, {body, Data, Cont}) ->
      {body, Data, Req#http_req{multipart = {Length, Cont}}};
  multipart_data(Req, Length, {end_of_part, Cont}) ->
      {end_of_part, Req#http_req{multipart = {Length, Cont}}};
  multipart_data(Req, 0, eof) ->
      {eof, Req#http_req{body_state = done, multipart = undefined}};
  multipart_data(Req = #http_req{socket = Socket, transport = Transport},
          Length, eof) ->
      %% We just want to skip so no need to stream data here.
      {ok, _Data} = Transport:recv(Socket, Length, 5000),
      {eof, Req#http_req{body_state = done, multipart = undefined}};
  multipart_data(Req, Length, {more, Parser}) when Length > 0 ->
      case stream_body(?UPLOAD_PART_SIZE, Req) of
          {ok, <<Data:Length/binary, Buffer/binary>>, Req2} ->
              multipart_data(Req2#http_req{buffer = Buffer}, 0, Parser(Data));
          {ok, Data, Req2} ->
              multipart_data(Req2, Length - byte_size(Data), Parser(Data));
          Error ->
  