protected function getKeyOrNull($model)
    {
        if ($model == null) {
            return null;
        }
        return $model->{self::ROW_NUM_COLUMN} ?: ($model instanceof Model ? $model->getKey() : null);
    }