protected function createModelIdentity(
        $modelClass,
        $id,
        $keyName = null
    ) {
        if (is_null($id)) {
            return null;
        }

        $model = new $modelClass();

        if (!$model instanceof Model) {
            throw new RuntimeException(sprintf('Expecting a model class, got %s.', $modelClass));
        }

        $model->setAttribute($keyName ?: $model->getRouteKeyName(), $id);

        return $model;
    }