anchor.diff:    Devices = lists:foldl(Callback, [], Permissions),
     {ok, Devices}.
   
  +-spec(get_device_by_uid(UniqueId :: string()) -> {ok, #device{}} | {error, string()}).
   get_device_by_uid(UniqueId) ->
     em_storage:get_device_by_uid(UniqueId).
   
  +-spec(get_all_devices() -> {ok, [#device{}]} | {error, string()}).
   get_all_devices() ->
       em_storage:get_devices().
   
  +-spec(link_device(Permission :: #permission{}) -> {ok, #permission{}} | {error, string()}).
   link_device(Permission) ->
       em_storage:create_permission(Permission).
   
  +-spec(unlink_device(Permission :: #permission{}) -> {ok, #permission{}} | {error, string()}).
   unlink_device(Permission) ->
     em_storage:delete_permission(Permission).
  
positive.code:           {error, <<"Duplicate email">>}
      end.
  
  update_user(User) ->
    em_storage:update_user(User).
  
  delete_user(User) ->
      em_storage:delete_user(User).
  
  check_user(Email, Password) ->
    CheckPass = fun(CurrPassword, User = #user{hashPassword = HashPassword}) ->
                  case CurrPassword =:= HashPassword of
  
negative.code:     Reason -> Reason
    end.
  
  -spec(get_users() -> {ok, [#user{}]} | {error, string()}).
  get_users() ->
      em_storage:get_users().
  
  -spec(create_device(Device :: #device{}) -> {ok, #device{}} | {error, string()}).
  create_device(Device) ->
      em_storage:create_device(Device).
  
  -spec(update_device(Device :: #device{}) -> {ok, #device{}} | {error, string()}).
  update_device(Device) ->
      em_storage:update_device(Device).
  
  -spec(delete_device(Device :: #device{}) -> {ok, #device{}} | {error, string()}).
  delete_device(Device) ->
      em_storage:delete_device(Device).
  
  -spec(get_devices(UserId :: integer()) -> {ok, [#device{}]} | {error, string()}).
  get_devices(UserId) ->
    Callback = fun(Permission = #permission{deviceId = DeviceId}, Acc) ->
                  em_logger:info("PERMISSION: ~w", [Permission]),
  