public async Task <ActionResult <GradeDto> > DeleteGrade(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var gradeDto = await _context.Grades.Select(GradeDto.AsGradeDto).SingleOrDefaultAsync(m => m.Id == id);

            if (gradeDto == null)
            {
                return(NotFound());
            }

            // var grade = GradeDto.AsGradeFunc(gradeDto);

            // _context.Grades.Remove(grade);

            // await SaveChangesAndRemoveCacheAsync(CacheKeys.Grade);
            try
            {
                var deleted = await gradeService.DeleteGradeAsync(gradeDto);

                if (deleted)
                {
                    this.RemoveCache(CacheKeys.Grade);
                }
                else
                {
                    return(BadRequest("Delete failed!."));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }

            return(gradeDto);
        }