* @return the booked service, if successful, null if not
*/
@SuppressWarnings("unchecked")
public synchronized <T extends IService> T getAndBookService(
Class<?> serviceType, Object purpose) {
IServiceManagement sm = serviceTypes.get(serviceType);
if (sm != null) {
List<IService> services = sm.getList();
for (int i = 0; i < services.size(); i++) {
IService service = services.get(i);
if (bookService(service, purpose)) {
return (T) service;
}