private static string deleteBateria(DBStorage db, string message) { BateriaQuery query; try { query = (BateriaQuery)JsonConvert.DeserializeObject(message, typeof(BateriaQuery)); } catch (Exception) { return("ERR"); } if (query == null || query.id <= 0 || query.redElectrica <= 0) { return("ERR"); } return(db.deleteBateriaRedElectrica(query.redElectrica, query.id) ? "OK" : "ERR"); }