anchor.diff:  do_update_device(#state{topology = Topology}, Rec) ->
       Map = to_map(device, Rec),
       Callback = fun(Worker) ->
  -                       Key = #{<<"id">> => Rec#device.id},
  -                       Command = #{<<"$set">> => maps:remove(<<"id">>, Map)},
  +                       Key = #{<<"_id">> => id_to_objectid(Rec#device.id)},
  +                       Command = #{<<"$set">> => maps:remove(<<"_id">>, Map)},
                          mc_worker_api:update(Worker, ?COLLECTION_DEVICES, Key, Command)
                  end,
       Res = mongoc:transaction(Topology, Callback),
  
positive.code: 
  
  do_create_permission(#state{topology = Topology}, Rec) ->
      Map = to_map(permission, Rec#permission{id = gen_uid()}),
      Callback = fun(Worker) ->
                         mc_worker_api:insert(Worker, ?COLLECTION_PERMISSIONS, Map)
                 end,
  
negative.code:       };
  from_map(permission, Map) ->
      #permission{
         id = objectid_to_id(maps:get(<<"_id">>, Map, 0)),
         userId = objectid_to_id(maps:get(<<"userId">>, Map, 0)),
         deviceId = objectid_to_id(maps:get(<<"deviceId">>, Map, 0))
        };
  from_map(user, Map) ->
      #user{
         id = objectid_to_id(maps:get(<<"_id">>, Map, 0)),
         name = maps:get(<<"name">>, Map, <<"">>),
         email = maps:get(<<"email">>, Map, <<"">>),
         readonly = maps:get(<<"readonly">>, Map, false),
  