protected static function filterCondition(array $condition)
    {
        $result = [];
        // valid column names are table column names or column names prefixed with table name
        $columnNames = static::getTableSchema()->getColumnNames();
        $tableName = static::tableName();
        $columnNames = array_merge(
            $columnNames, array_map(
                function ($columnName) use ($tableName) {
                    return "$tableName.$columnName";
                }, $columnNames
            )
        );
        foreach ($condition as $key => $value) {
            if (is_string($key) && !in_array($key, $columnNames, true)) {
                throw new InvalidArgumentException('Key "' . $key . '" is not a column name and can not be used as a filter');
            }
            $result[$key] = is_array($value) ? array_values($value) : $value;
        }

        return $result;
    }