public function refreshState($cacheName, $item, $mode, $limitCache)
    {
        $cachedItems = $this->all();

        // check if this item exists
        $currentItemKey = null;
        if($cachedItems) {
            $keyName = $item->getKeyName();
            $keyValue = $item->getKey();
            foreach ($cachedItems as $index => $row) {
                if ($row[$keyName] == $keyValue) {
                    $currentItemKey = [$index => $row];
                    break;
                }
            }
        }

        // DELETE
        if($mode == 'deleted') {
            if ($currentItemKey) {
                unset($cachedItems[key($currentItemKey)]);
            }
        }else {
            // UPDATE
            if ($currentItemKey) {
                $cachedItems[key($currentItemKey)] = $item->toArray();

            } else { // ADD
                // push new item to cache
                $newCachedItems = [];
                array_push($newCachedItems, $item->toArray());

                $cachedItems = array_merge($newCachedItems, $cachedItems);

                // Limit results
                if($limitCache) {
                    $countItems = count($cachedItems);
                    if ($countItems > $limitCache) {
                        $cachedItems = array_slice($cachedItems, 0, ($limitCache - $countItems));
                    }
                }

            }
        }

        // Save cache
        Cache::forever($cacheName, $cachedItems);

        return $this;
    }