//[Authorize(Roles = nameof(PermissionProvider.AddArea))] public HttpResponseMessage Update(HttpRequestMessage request, CountryRegion countryRegion) { return(CreateHttpResponse(request, () => { try { HttpResponseMessage reponse = null; if (!ModelState.IsValid) { reponse = request.CreateResponse(HttpStatusCode.BadRequest, ModelState); } else { _countryRegionService.UpdateAsync(countryRegion); reponse = request.CreateResponse(HttpStatusCode.OK, countryRegion); } return reponse; } catch (NameDuplicatedException dex) { return request.CreateErrorResponse(HttpStatusCode.Conflict, dex.Message); } })); }