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