public static Score GetScoreByKey(int idGame)
        {
            Score oScore = new Score();

            try
            {
                using (var ctx = new PollaExpressDBEntities())
                {
                    ctx.Configuration.ProxyCreationEnabled = false;

                    oScore =
                        ctx.Score.Where(x => x.idGame.Equals(idGame)).FirstOrDefault();
                }
            }
            catch (Exception ex) { throw ex; }

            return oScore;
        }
        public static void SaveScore(Score score)
        {
            try
            {
                using (var ctx = new PollaExpressDBEntities())
                {
                    //verify if the student exists
                    Score oScore = GetScoreByKey(score.idGame);

                    if (oScore != null)
                    {
                        // if exists then edit
                        ctx.Score.Attach(oScore);
                        EntityFrameworkHelper.EnumeratePropertyDifferences(oScore, score);
                        ctx.SaveChanges();
                    }
                    else
                    {
                        // else create
                        ctx.Score.Add(score);
                        ctx.SaveChanges();
                    }
                }

            }
            catch (DbEntityValidationException e)
            {
                StringBuilder oError = new StringBuilder();
                foreach (var eve in e.EntityValidationErrors)
                {
                    oError.AppendLine(string.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                        eve.Entry.Entity.GetType().Name, eve.Entry.State));

                    foreach (var ve in eve.ValidationErrors)
                    {
                        oError.AppendLine(string.Format("- Property: \"{0}\", Error: \"{1}\"",
                            ve.PropertyName, ve.ErrorMessage));
                    }
                }
                string msg = oError.ToString();
                throw new Exception(msg);
            }
            catch (Exception ex) { throw ex; }
        }
        public void SaveGameScore(Score score, string rootPath)
        {
            ScoreCRUD.SaveScore(score);

            FindWinners(score.idGame, rootPath);
        }