private static function handleFilter(String &$sql, $filter, LightModel $class): array
    {
        $params = [];

        if (isset($filter[self::FILTER_ORDER]))
        {
            $order = $filter[self::FILTER_ORDER];
            unset($filter[self::FILTER_ORDER]);
        }

        if (isset($filter[self::FILTER_LIMIT]))
        {
            $limit = (int) $filter[self::FILTER_LIMIT];
            unset($filter[self::FILTER_LIMIT]);
        }

        foreach ($filter as $filter => $value)
        {
            if (! $class->getTable()->hasColumn($filter))
                continue;

            //Default operator for all queries
            $operator = '=';

            //Check if the operator was passed in
            if (is_array($value))
            {
                $operator = $value[0];
                $value = $value[1];
            }

            switch ($class->getTable()->getColumn($filter)->getType())
            {
                case Column::TYPE_INT:
                    $value = (int) $value;
                    break;
                default:
                    $value = (string) $value;
            }

            $sql .= ' AND `' . $filter . '` ' . $operator . ' :' . $filter;
            $params[':' . $filter] = $value;
        }

        if (isset($order))
        {
            $sql .= ' ORDER BY ' . $order;
        }

        if (isset($limit))
        {
            $sql .= ' LIMIT ' . $limit;
        }

        return $params;
    }