public static PredictorPredictContext GetPredictContext(this Lite <PredictorEntity> predictor)
        {
            lock (TrainedPredictorCache)
                return(TrainedPredictorCache.GetOrCreate(predictor, () =>
                {
                    using (ExecutionMode.Global())
                        using (var t = Transaction.ForceNew())
                        {
                            var p = predictor.RetrieveAndRemember();
                            if (p.State != PredictorState.Trained)
                            {
                                throw new InvalidOperationException($"Predictor '{p.Name}' not trained");
                            }

                            PredictorPredictContext ppc = CreatePredictContext(p);
                            return t.Commit(ppc);
                        }
                }));
        }