public void Update(string updatedText, CodedValue code) { if (string.IsNullOrEmpty(updatedText)) { throw new ArgumentException("newText"); } if (MatchesText(updatedText)) { // Same text. We'll keep any existing codes that merge in the new code if (code != null) { Codes.AddIfDoesNotExist(code); } } else { // Text is different. Replace(updatedText, code); } }