anchor.diff:  %%%===================================================================
   %%% API
   %%%===================================================================
  +-spec(get() -> {ok, [Rec :: #permission{}]} | {error, string()}).
  +get() ->
  +  gen_server:call(?SERVER, {get}).
  +
   -spec(get_by_user_id(Id :: integer()) -> {ok, [Rec :: #permission{}]} | {error, string()}).
   get_by_user_id(Id) ->
     gen_server:call(?SERVER, {get, Id}).
  
positive.code: do_delete_permission(State = #state{cache = Cache}, PermissionModel) ->
    case em_storage:delete_permission(PermissionModel) of
      {ok, Permission} ->
        case ets:delete(Cache, Permission#permission.id) of
          true ->
            {reply, {ok, Permission}, State};
          false -> {reply, {error, <<"Error sync in permissions cache">>}, State}
        end;
      Reason ->
        {reply, Reason, State}
  
negative.code: %%%===================================================================
  %%% Internal functions
  %%%===================================================================
  do_get_permissions(State = #state{cache = Cache}) ->
    {reply, {ok, ets:tab2list(Cache)}, State}.
  
  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}.
  