public PN_Counter Add(int value, Guid nodeId) { var element = Additions.FirstOrDefault(e => e.Node.Id == nodeId); if (element is null) { element = new CounterElement(value, nodeId); } else { element.Add(value); } var additions = Additions.Where(e => e.Node.Id != nodeId).ToImmutableHashSet(); additions = additions.Add(element); return(new PN_Counter(additions, Subtractions)); }