private static string addSmelting(DBStorage db, string message) { Smelting smelting; try { smelting = (Smelting)JsonConvert.DeserializeObject(message, typeof(Smelting)); } catch (Exception) { return("ERR"); } if (smelting == null || !smelting.isValid()) { return("ERR"); } return(db.addSmelting(smelting) ? "OK" : "ERR"); }