private void AddSpec(JArray ja, IDictionary <String, int> specopts, string scat, int number, int productId) { int value; if (!String.IsNullOrWhiteSpace(scat)) { if (!specopts.TryGetValue(scat + number, out value)) { throw new KeyNotFoundException("Key: " + scat + number + " not found in the dictionary"); } ja.Add(ParserJSon.getProductSpecificationAttributeJson(value, true, productId)); } }