public void AddRandomAssignments()
        {
            var aCrs = (
                from ac in dbContext.ActiveCourses
                select ac
                ).ToList();

            foreach (var aCr in aCrs)
            {
                exists = false;
                ActiveAssignment aa = new ActiveAssignment();
                aa.CourseID       = aCr.CourseID;
                aa.StudentID      = aCr.StudentID;
                aa.AssignmentID   = 1; //final
                aa.SubmissionDate = aCr.AvailableCourse.EndDate.Value.AddDays(-15);
                aa.ActiveCourse   = aCr;

                var assign = (
                    from ass in dbContext.ActiveAssignments
                    select ass
                    ).ToList();

                foreach (var ass in assign)
                {
                    if (ass.CourseID == aa.CourseID)
                    {
                        if (ass.StudentID == aa.StudentID)
                        {
                            if (ass.AssignmentID == aa.AssignmentID)
                            {
                                exists = true;
                            }
                        }
                    }
                }
                if (!exists)
                {
                    try
                    {
                        dbContext.ActiveAssignments.Add(aa);
                        Console.WriteLine("Press key to Add Courses");
                        Console.ReadKey();
                        dbContext.SaveChanges();
                    }
                    catch (System.Data.Entity.Infrastructure.DbUpdateException)
                    {
                        Console.WriteLine("Entity exists");
                    }
                }

                if (aCr.AvailableCourse.Course.Type.Trim().Equals("Full Time"))
                {
                    exists = false;
                    ActiveAssignment ma = new ActiveAssignment();
                    ma.CourseID       = aCr.CourseID;
                    ma.StudentID      = aCr.StudentID;
                    ma.AssignmentID   = 2; //final
                    ma.SubmissionDate = aCr.AvailableCourse.StartDate.Value.AddMonths(3);


                    var assign2 = (
                        from ass in dbContext.ActiveAssignments
                        select ass
                        ).ToList();


                    foreach (var ass in assign2)
                    {
                        if (ass.CourseID == ma.CourseID)
                        {
                            if (ass.StudentID == ma.StudentID)
                            {
                                if (ass.AssignmentID == ma.AssignmentID)
                                {
                                    exists = true;
                                }
                            }
                        }
                    }
                    if (!exists)
                    {
                        try
                        {
                            dbContext.ActiveAssignments.Add(ma);
                            Console.WriteLine("Press key to Add Courses");
                            Console.ReadKey();
                            dbContext.SaveChanges();
                        }
                        catch (System.Data.Entity.Infrastructure.DbUpdateException)
                        {
                            Console.WriteLine("Entity exists");
                        }
                    }
                }
            }
        }
        //TODO 13: Match Assingments to Courses and Students
        public void CreateActiveAssignment()
        {
            string courseTitle;
            int    assignmentID;

            Console.Clear();

            tv.ViewActiveCourses();

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Be exact in typing");
            Console.Write("Select a Course by typing the Title: ");

            Console.ResetColor();
            courseTitle = Console.ReadLine();

            var activeCourses = (
                from actCrs in dbContext.ActiveCourses
                join crs in dbContext.Courses on actCrs.CourseID equals crs.ID
                join avlCrs in dbContext.AvailableCourses on actCrs.CourseID equals avlCrs.CourseID
                where crs.Title == courseTitle
                select actCrs
                ).ToList();

            tv.ViewAssignments();

            Console.ForegroundColor = ConsoleColor.Green;
            Console.Write("Select an assignment type by typing in the ID:");
            Console.ResetColor();
            assignmentID = int.Parse(Console.ReadLine());
            var assignment = (
                from ass in dbContext.Assignments
                where ass.ID == assignmentID
                select ass
                ).FirstOrDefault();

            Console.ForegroundColor = ConsoleColor.Green;
            Console.Write("Input Submission Date: ");
            Console.ResetColor();
            DateTime subDate = DateTime.Parse(Console.ReadLine());

            foreach (var activeCourse in activeCourses)
            {
                ActiveAssignment activeAssignment = new ActiveAssignment()
                {
                    CourseID       = activeCourse.CourseID,
                    StudentID      = activeCourse.StudentID,
                    AssignmentID   = assignment.ID,
                    SubmissionDate = subDate
                };
                dbContext.ActiveAssignments.Add(activeAssignment);
            }

            Console.ForegroundColor = ConsoleColor.Green;
            Console.Write("Commit changes? y/n ");
            Console.ResetColor();
            string input = Console.ReadLine().ToLower();

            if (input.Equals("y"))
            {
                dbContext.SaveChanges();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Changes saved to database.");
                Console.ResetColor();
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Changes not committed. Please retry.");
                Console.ResetColor();
            }

            Console.ReadKey();
        }