private void UpdateServiceProperties(HttpContext context) { Int16 servicePropertId = 0; JObject propertyObject = null; JArray propertyFieldsArray = null; ServiceProperty servicePropert = new ServiceProperty(); List <ServicePropertyFields> servicePropertiesFieldList = new List <ServicePropertyFields>(); if (context.Request["ServicePropertyId"] == null || !Int16.TryParse(context.Request["ServicePropertyId"].ToString(), out servicePropertId)) { GenerateErrorResponse(400, string.Format("Parameter ServicePropertyId is missing or not a valid number")); } try { propertyObject = JObject.Parse(context.Request["Property"].ToString()); } catch (Exception e) { GenerateErrorResponse(400, string.Format("Invalid JSON")); } try { propertyFieldsArray = JArray.Parse(propertyObject.SelectToken("PropertyFields").ToString()); } catch (Exception ex) { GenerateErrorResponse(400, string.Format("Invalid JSON")); } ServiceProperty serviceProperty = ValidateServiceProperties(propertyObject); serviceProperty.Id = servicePropertId; List <ServicePropertyFields> servicePropertFields = ValidateServicePropertyFields(propertyFieldsArray, serviceProperty); OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON); context.Response.Write(client.UpdateServiceProperty(serviceProperty, servicePropertiesFieldList)); }