public async Task <IActionResult> Delete(int id, CancellationToken cancellationToken) { var template = await _templatesService.GetCallQuickTemplateByIdAsync(id); if (template == null || template.DepartmentId != DepartmentId) { Unauthorized(); } await _templatesService.DeleteCallQuickTemplateAsync(id, cancellationToken); return(RedirectToAction("Index")); }