public async Task <IActionResult> Delete(string language) { string accessToken = await HttpContext.GetToken(); var session = await sessionService.GetSession(accessToken); if (session == null) { return(Unauthorized(new { message = "Session expired. Please login again." })); } if (session.UserId != Constants.AdminUser) { return(BadRequest(new { message = "Not authorized" })); } try { var result = await wordRepository.DeleteDictionary(language); return(Ok(result)); } catch (Exception ex) { await log.ErrorAsync("Error in wordRepository.DeleteDictionary()", ex); return(BadRequest(new { title = ex.GetType().ToString(), details = ex.StackTrace, message = ex.Message })); } }