public Revision WriteHours(WorkItem item, byte hours, bool setActive) { item.AddHours(hours, setActive); SaveElement(item); Trace.WriteLine( $"{nameof(TfsApi)}.{nameof(WriteHours)}: From task {item.Id} was writed off {hours} hour(s)"); var revisions = item.Revisions.OfType <Revision>(); var finded = revisions .Where(x => x.Fields.TryGetById((int)CoreField.ChangedBy) != null && x.Fields.Contains(WorkItems.Fields.Complited) && Equals(Name, x.Fields[CoreField.ChangedBy].Value) && x.Fields[WorkItems.Fields.Complited].Value != null) .OrderByDescending(x => (DateTime)x.Fields[CoreField.ChangedDate].Value) .ToList(); return(finded.FirstOrDefault()); }