final Application app = command.getApplication();
if (app != null) {
command.setApplication(null);
return app;
} else {
throw new GenieNotFoundException("No application set for command with id '" + id + "'.");
}
} else {
throw new GenieNotFoundException("No command with id " + id + " exists.");
}
}