public async System.Threading.Tasks.Task <string> ValidateWorkItemStateAsync() { string result = ""; string bodycontent = await Request.Content.ReadAsStringAsync(); JObject wit = JObject.Parse(bodycontent); var resource = wit["resource"]; var workItemId = resource["workItemId"]; var fieldStatus = resource["fields"].Where(t => t.ToString().Contains("System.State")).SingleOrDefault(); var oldValue = fieldStatus.Values("oldValue").Select(t => (string)t).SingleOrDefault(); var newValue = fieldStatus.Values("newValue").Select(t => (string)t).SingleOrDefault(); if (!IsValidStated(oldValue, newValue)) { WorkItemManager aux = new WorkItemManager(); aux.ReassignState(workItemId.ToString(), oldValue); } return(result); }