public ScormPackageUserEvaluation ScormSaveEvaluation(liteModuleLink link, dtoPackageEvaluation dto, Int32 idPerson, DateTime referenceTime, Boolean isCalculated = false, Boolean isCreatedByPlayer = false)
        {
            ScormPackageUserEvaluation evaluation = null;

            if (idPerson > 0)
            {
                try
                {
                    if (dto.Id > 0)
                    {
                        evaluation = Manager.Get <ScormPackageUserEvaluation>(dto.Id);
                    }
                    else
                    {
                        evaluation = ScormQuery(dto, idPerson, (link == null) ? 0 : link.Id).Skip(0).Take(1).ToList().FirstOrDefault();
                    }
                    if ((evaluation == null || evaluation.Id == 0) && dto.IdItem > 0 && dto.UniqueIdItem != Guid.Empty)
                    {
                        Manager.BeginTransaction();
                        evaluation = ScormPackageUserEvaluation.CreateBy(link, dto, idPerson, referenceTime, isCalculated, isCreatedByPlayer);
                        Manager.SaveOrUpdate(evaluation);
                        Manager.Commit();
                    }
                    else
                    {
                        Manager.BeginTransaction();
                        evaluation.UpdateStatisticsBy(dto, referenceTime, isCalculated);
                        Manager.Commit();
                    }
                }
                catch (Exception ex)
                {
                    Manager.RollBack();
                    evaluation = null;
                }
            }

            return(evaluation);
        }
        public ScormPackageUserEvaluation ScormUpdateEvaluation(dtoPackageEvaluation dto, DateTime referenceTime, Boolean isCalculated)
        {
            ScormPackageUserEvaluation evaluation = null;

            try
            {
                if (dto.Id > 0)
                {
                    evaluation = Manager.Get <ScormPackageUserEvaluation>(dto.Id);
                    if (evaluation != null && evaluation.Id == 0)
                    {
                        Manager.BeginTransaction();
                        evaluation.UpdateStatisticsBy(dto, referenceTime, isCalculated);
                        Manager.Commit();
                    }
                }
            }
            catch (Exception ex)
            {
                Manager.RollBack();
                evaluation = null;
            }
            return(evaluation);
        }