anchor.diff:            {error, <<"Duplicate email">>}
       end.
   
  +-spec(update_user(User :: #user{}) -> {ok, #user{}} | {error, string()}).
   update_user(User) ->
     em_storage:update_user(User).
   
  +-spec(delete_user(User :: #user{}) -> {ok, #user{}} | {error, string()}).
   delete_user(User) ->
       em_storage:delete_user(User).
   
  +-spec(check_user(Email :: string(), Password :: string()) -> {ok, #user{}} | {error, string()}).
   check_user(Email, Password) ->
     CheckPass = fun(CurrPassword, User = #user{hashPassword = HashPassword}) ->
                   case CurrPassword =:= HashPassword of
  
positive.code:   Devices = lists:foldl(Callback, [], Permissions),
    {ok, Devices}.
  
  get_device_by_uid(UniqueId) ->
    em_storage:get_device_by_uid(UniqueId).
  
  get_all_devices() ->
      em_storage:get_devices().
  
  link_device(Permission) ->
      em_storage:create_permission(Permission).
  
  unlink_device(Permission) ->
    em_storage:delete_permission(Permission).
  
negative.code:           Reason
        end.
  
  -spec(get_positions(DeviceId :: integer(), TimeFrom :: integer(), TimeTo :: integer()) -> {ok, [#position{}]} | {error, string()}).
  get_positions(DeviceId, TimeFrom, TimeTo) ->
      em_storage:get_positions(DeviceId, TimeFrom, TimeTo).
  
  -spec(get_last_position(PositionId :: integer(), DeviceId :: integer()) -> {ok, #position{}} | {error, string()}).
  get_last_position(PositionId, DeviceId) ->
      em_storage:get_last_position(PositionId,  DeviceId).
  
  -spec(create_user(User :: #user{}) -> {ok, #user{}} | {error, string()}).
  create_user(User) ->
      case em_storage:get_user_by_email(User#user.email) of
        {error, _Reason} ->
  