public DepartmentCheckResult CheckIfDepartmentNameUsed(string departmentName) { var result = new DepartmentCheckResult(); if (!String.IsNullOrWhiteSpace(departmentName)) { var name = HttpUtility.UrlDecode(departmentName); result.DepartmentNameInUse = _departmentsService.DoesDepartmentExist(name); return(result); } throw HttpStatusCode.BadRequest.AsException(); }