public async Task <IActionResult> GetAssignment([FromBody] AssignRequest assignRequest)
        {
            IActionResult resp = NotFound();

            try
            {
                var exam = await db.Exams.FirstOrDefaultAsync(e => e.Id == assignRequest.ExamId);

                var student = await db.Students.FirstOrDefaultAsync(s => s.Id == assignRequest.StudentId);

                var now = DateTime.UtcNow;

                if (exam != null && exam.AuthenticationCode == assignRequest.AuthenticationCode && student != null &&
                    student.Number == assignRequest.StudentNumber &&
                    (!exam.IsLimitedAccess || exam.IsLimitedAccess && exam.Start <= now &&
                     exam.Start.AddMinutes(exam.DurationMinutes) >= now))
                {
                    //ok, we believe that you are one of the students who should get a set of documents from this exam (one per question)
                    var documents = await getDocumentsForStudent(exam, student,
                                                                 HttpContext.Connection.RemoteIpAddress?.ToString());

                    //notify prof that a student has been allocated something
                    await sendNotification(exam, student, documents);

                    //zip the files
                    var ms = await AssignmentHandler.CreateZipArchive(documents, student.Name);

                    resp = File(ms.ToArray(), "application/zip", $"{student.Name}.zip");

                    logger.LogTrace(
                        $"{assignRequest} fulfilled with {string.Join(",", documents.Select(d => d.Id).ToList())}");
                }
                else
                {
                    logger.LogWarning($"{assignRequest} not a match or too early {exam?.IsLimitedAccess}");
                    if (exam?.IsLimitedAccess ?? false)
                    {
                        resp = BadRequest();
                    }
                }
            }
            catch (Exception ex)
            {
                logger.LogError(ex, assignRequest.ToString());
                resp = StatusCode(statusCode: 500);
            }

            return(resp);
        }