public JsonResult Delete(int id)
 {
     try {
         _repository.DeleteCourse(id);
         if (_repository.SaveAll())
         {
             Response.StatusCode = (int)HttpStatusCode.NoContent;
             return(Json("course deleted"));
         }
     }
     catch (Exception ex)
     {
         _logger.LogError("Failed to delete course", ex);
         return(Json("Failed to delete new course"));
     }
     return(Json("Failed to delete course. Cannot find course"));
 }