anchor.diff:    {noreply, NewState :: #state{}, timeout() | hibernate} |
     {stop, Reason :: term(), Reply :: term(), NewState :: #state{}} |
     {stop, Reason :: term(), NewState :: #state{}}).
  +handle_call({get}, _From, State) ->
  +  do_get_permissions(State);
   handle_call({get, Id}, _From, State) when is_integer(Id) ->
     do_get_permissions_by_user_id(State, Id);
   handle_call({create, Permission}, _From, State) ->
  
positive.code: %%%===================================================================
  %%% Internal functions
  %%%===================================================================
  do_get_permissions_by_user_id(State = #state{cache = Cache}, SearchUserId) ->
    Match = ets:fun2ms(fun(Permission = #permission{userId = UserId}) when UserId =:= SearchUserId -> Permission end),
    {reply, {ok, ets:select(Cache, Match)}, State}.
  
negative.code: do_delete_permission(State = #state{cache = Cache}, PermissionModel) ->
    case em_storage:delete_permission(PermissionModel) of
      {ok, Permission} ->
        Match = ets:fun2ms(fun(#permission{userId = UserId, deviceId = DeviceId}) when (UserId =:= Permission#permission.userId) and (DeviceId =:= Permission#permission.deviceId) -> true end),
        case ets:select_delete(Cache, Match) of
          0 ->
            {reply, {error, <<"Error sync in permissions cache">>}, State};
          _ ->
            {reply, {ok, Permission}, State}
        end;
      Reason ->
        {reply, Reason, State}
  