long extractId(Object uri) throws BadInputException {
try {
return Long.parseLong(uri.toString().substring(uri.toString().lastIndexOf("/") + 1));
} catch (NumberFormatException ex) {
throw new BadInputException(ex);
} catch (NullPointerException ex) {
throw new BadInputException(ex);
}
}