protected function filterValues($table, array $data)
    {
        $scheme = $this->getScheme($table);
        $values = array_intersect_key($data, $scheme['fields']);

        if (empty($values)) {
            return array();
        }

        foreach ($values as $field => &$value) {

            if (!empty($scheme['fields'][$field]['auto_increment'])) {
                unset($values[$field]);
                continue;
            }

            if (is_null($value) && !empty($scheme['fields'][$field]['not_null'])) {
                unset($values[$field]);
                continue;
            }

            if (!empty($scheme['fields'][$field]['serialize'])) {
                if (!is_array($value)) {
                    $value = array();
                }
                $value = serialize($value);
            }
        }

        return $values;
    }