private async Task Update(Card card)
 {
     var doc = CreateUpdateDocument(card);
     await WorkItemsClient.UpdateWorkItemAsync(doc, card.Id);
 }
 private static Operation GetOperation(Card card)
 {
     return card.OriginalPriority == null
         ? Operation.Add
         : Operation.Replace;
 }
 private static int GetParentId(IEnumerable<Card> cards, Card card, int depth)
 {
     var parent = cards.FirstOrDefault(c => c.Id == card.FeatureId);
     if ((parent.FeatureId == null) || (depth == 0))
         return parent.Id;
     return GetParentId(cards, parent, --depth);
 }
 private JsonPatchDocument CreateUpdateDocument(Card card)
 {
     return new JsonPatchDocument
     {
         new JsonPatchOperation
         {
             Path = "/fields/" + PriorityFieldNameFor(card.Project),
             Operation = GetOperation(card),
             Value = card.Priority ?? 0
         }
     };
 }