You are doing double dictionary lookups - one to check presence and another to extract. Dictionary.TryGetValue solves this problem by doing both with one operation. The patterns applies across this method.