public static LessonLevelsDTO GetLessonLevel(long?id = null, string name = null)
        {
            if (!id.HasValue && string.IsNullOrEmpty(name))
            {
                return(null);
            }

            try
            {
                using (var ctx = new DAL.tutorDBEntities())
                {
                    var dbLessonLevel = ctx.LessonLevels.FirstOrDefault(x => x.id == id || x.name == name);
                    if (dbLessonLevel != null)
                    {
                        var lessonLevel = new LessonLevelsDTO
                        {
                            id   = dbLessonLevel.id,
                            name = dbLessonLevel.name
                        };

                        return(lessonLevel);
                    }
                    throw new Exception($"Уровень обучения: {name} не найден");
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
        public static long CreateUpdateLessonLevel(LessonLevelsDTO lessonLevels)
        {
            try
            {
                using (var ctx = new DAL.tutorDBEntities())
                {
                    var dbLessonLevel = ctx.LessonLevels.FirstOrDefault(x => x.id == lessonLevels.id) ?? ctx.LessonLevels.Add(new DAL.LessonLevels());

                    if (ctx.LessonLevels.Any(x => x.name == lessonLevels.name && x.id != dbLessonLevel.id))
                    {
                        throw new Exception($"Уровень образования: {lessonLevels.name} уже существует");
                    }


                    dbLessonLevel.name = lessonLevels.name;

                    ctx.SaveChanges();

                    return(dbLessonLevel.id);
                }
            }
            catch (Exception ex)
            {
                throw;
                //return -1;
            }
        }