public async Task <IActionResult> Confirm([FromBody] TestTaskResultDto model)
        {
            var userId = User.FindFirstValue("sub");
            await _testTaskResultService.Confirm(userId, model);

            return(Ok(new { }));
        }
        public async Task Confirm(string userId, TestTaskResultDto model)
        {
            var user = await _context.Users
                       .Include(x => x.UserGroups)
                       .ThenInclude(x => x.Group)
                       .FirstOrDefaultAsync(x => x.Id == userId);

            var task = await _context.TestTasks.FindAsync(model.TestTaskId);

            var result = new TestTaskResult()
            {
                Task   = task,
                Group  = user.UserGroups != null && user.UserGroups.Count > 0 ? user.UserGroups[0].Group : null,
                Sender = user,
                Points = model.Questions
                         .Select(x => x.Points)
                         .Aggregate((x, y) => x + y)
            };
            await _context.TestTaskResults.AddAsync(result);

            await _context.SaveChangesAsync();
        }