public async virtual Task <Assignment> GetAssignmentById(int?id)
        {
            if (id == null)
            {
                return(null);
            }

            var assignment = await Assignments.FindAsync(id);

            Entry(assignment).Reference(x => x.AssignmentSpecification).Load();
            Entry(assignment).Reference(x => x.Course).Query().Load();
            Entry(assignment).Reference(x => x.Language).Load();
            Entry(assignment).Reference(x => x.Institution).Load();
            Entry(assignment).Reference(x => x.Difficulty).Load();
            Entry(assignment).Reference(x => x.AssignmentVisibilityProtectionLevel).Load();
            Entry(assignment).Collection(x => x.Instructors).Query().Include(x => x.Instructor).Load();
            Entry(assignment).Reference(x => x.ReferenceSolution).Load();
            Entry(assignment).Reference(x => x.ReferenceTestCasesSolutions).Load();
            Entry(assignment).Collection(x => x.AssignmentApplicationModes).Load();
            Entry(assignment).Collection(x => x.AssignmentApplicationModes).Query().Include(y => y.ApplicationMode).Load();
            Entry(assignment).Collection(x => x.AssignmentCoverageTypeOptions).Query().Include(y => y.CoverageTypeOption).Load();
            Entry(assignment).Reference(x => x.FeedbackLevelOption).Load();
            Entry(assignment).Reference(x => x.TestingTypeOption).Load();
            Entry(assignment).Collection(x => x.Instructors).Query().Include(a => a.Instructor).Load();
            Entry(assignment).Collection(x => x.Tags).Query().Include(a => a.Tag).Load();

            return(assignment);
        }
        public async virtual Task <byte[]> GetDocumentFileBytes(int id, string documentType)
        {
            var assignment = await Assignments.FindAsync(id);

            Entry(assignment).Reference(x => x.AssignmentSpecification).Load();
            Entry(assignment).Reference(x => x.ReferenceSolution).Load();
            Entry(assignment).Reference(x => x.ReferenceTestCasesSolutions).Load();

            switch (documentType)
            {
            case "AssignmentSpecification":
                return(assignment.AssignmentSpecification.FileBytes);

            case "ReferenceSolution":
                return(assignment.ReferenceSolution.FileBytes);

            case "ReferenceTestCasesSolutions":
                return(assignment.ReferenceTestCasesSolutions.FileBytes);
            }

            return(null);
        }