public static function filterRows($rows, $withPagination = true, $justForInTable = false, $filterColumns = array())
    {
        $filteredList = array();
        $temporaryList = array();
        $language = App::getLocale();

        if($withPagination) {
            if(!is_array($rows)) {
                $rows = $rows->toArray();
            }
            $list = $rows['data'];
        }else{
            if(is_a($rows, 'Illuminate\Support\Collection')) {
                $rows = $rows->toArray();
            }
            $list = $rows;
        }

        // loop throw the list
        foreach ($list as $rowKey => $row){
            if(gettype($row) == "object" && in_array('Illuminate\Database\Eloquent\Model', class_parents($row))) {
                $row = $row->getAttributes();
            }
            foreach ($row as $key => $value){
                $jsonValue = true;
                // Casts columns
                if(is_object($value)) {
                    $jsonValue = $value;
                }elseif(is_string($value) ) {
                    // non-casts columns
                    $jsonValue = json_decode($value);
                }

                if($justForInTable) {
                    //fields like ID, postID, title and createdByUserID should always be shown in the list
                    array_push($filterColumns, 'postID', 'belongsToID', 'title', 'createdByUserID');

                    if (in_array($key, $filterColumns)) {
                        if ($jsonValue && isset($jsonValue->$language)) {
                            $temporaryList[$key] = $jsonValue->$language;
                            $temporaryList["original_object_".$key] = $value;
                        }else{
                            // empty if there is no translation in the selected language
                            $temporaryList[$key] = $value;
                        }
                    }
                }else{
                    if ($jsonValue && isset($jsonValue->$language)) {
                        $temporaryList[$key] = $jsonValue->$language;
                        //store original object because we need it in vue js!
                        $temporaryList["original_object_".$key] = $value;
                    }else{
                        $temporaryList[$key] = $value;
                    }
                }
            }

            $filteredList[$rowKey] = $temporaryList;
        }

        if ($withPagination) {
            $rows['data'] = $filteredList;
        }else{
            $rows = $filteredList;
        }
        return $rows;
    }