public List <PromotionResponse> PromoteStudents(PromotionRequest promotionRequest, IEnumerable <Student> students)
        {
            var studyId = GetStudyId(promotionRequest.Studies);
            var futureEnrollmentIdExists = _context.Enrollment
                                           .Any(enrollment =>
                                                enrollment.Semester == (promotionRequest.Semester + 1) && enrollment.IdStudy == studyId);

            var futureEnrollmentId = 0;

            if (!futureEnrollmentIdExists)
            {
                futureEnrollmentId = CreateNewEnrollmentForNextSemester(studyId, promotionRequest.Semester);
            }
            else
            {
                futureEnrollmentId = _context.Enrollment
                                     .FirstOrDefault(enrollment =>
                                                     enrollment.Semester == (promotionRequest.Semester + 1) && enrollment.IdStudy == studyId)
                                     .IdEnrollment;
            }

            var studentsList = students.ToList();

            studentsList.ForEach(student =>
            {
                student.IdEnrollment = futureEnrollmentId;
            });
            _context.SaveChanges();

            return(studentsList.Select(student => new PromotionResponse()
            {
                IdEnrollment = futureEnrollmentId,
                Semester = promotionRequest.Semester + 1,
                Student = new Student()
                {
                    IndexNumber = student.IndexNumber,
                    FirstName = student.FirstName,
                    LastName = student.LastName,
                    BirthDate = student.BirthDate,
                    Password = student.Password,
                    IdEnrollment = student.IdEnrollment
                }
            })
                   .ToList());
        }
        public InsertStudentResponse InsertStudent(InsertStudentRequest request)
        {
            var student = new Student()
            {
                IndexNumber  = request.IndexNumber,
                FirstName    = request.FirstName,
                LastName     = request.LastName,
                BirthDate    = DateTime.ParseExact(request.BirthDate, "dd.MM.yyyy", null),
                Password     = request.Password,
                IdEnrollment = Convert.ToInt32(request.IdEnrollment)
            };

            _context.Student.Add(student);
            _context.SaveChanges();

            return(new InsertStudentResponse()
            {
                IndexNumber = request.IndexNumber,
                LastName = request.LastName
            });
        }