public Stylist GetStylist() { Stylist result = null; if (_stylistID == -1) { throw new Exception("Stylist id is -1. Did you forget to save it first?"); } try { result = Stylist.GetByID(_stylistID); } catch (MySqlException ex) { if (ex.Message.StartsWith("Cannot add or update a child row: a foreign key constraint fails")) { throw new Exception("Provided Stylist ID is not a real id"); } else { throw ex; } } return(result); }