anchor.diff:            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} ->
  
positive.code:     Reason -> Reason
    end.
  
  get_users() ->
      em_storage:get_users().
  
  create_device(Device) ->
      em_storage:create_device(Device).
  
  update_device(Device) ->
      em_storage:update_device(Device).
  
  delete_device(Device) ->
      em_storage:delete_device(Device).
  
  get_devices(UserId) ->
    Callback = fun(Permission = #permission{deviceId = DeviceId}, Acc) ->
                  em_logger:info("PERMISSION: ~w", [Permission]),
  
negative.code:           {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
  