private static string addDrone(DBStorage db, string message) { Drone drone; try { drone = (Drone)JsonConvert.DeserializeObject(message, typeof(Drone)); } catch (Exception) { return("ERR"); } if (drone == null || !drone.isValid()) { return("ERR"); } return("" + db.addDrone(drone)); }