public ModelAppResponse handleRequest(HTTPMethod method, String relativePath, String body, ModelUser user) {
		Object response = null;
		T bodyEntity = null;
		try {
			if (method == HTTPMethod.PUT || method == HTTPMethod.POST) {
				bodyEntity = mapper.readValue(body, getModelClass());
				if (bodyEntity != null) {
					bodyEntity.setUsermail(user.getUserMail());
				}
			}

			switch (method) {
			case HEAD:
			case GET:
				if (relativePath.isEmpty()) {
					response = getAll(user);
				} else if (relativePath.matches("\\/\\d+")) {
					response = getById(Integer.parseInt(relativePath.substring(1)), user);
				}
				break;
			case POST:
				if (relativePath.isEmpty()) {
					bodyEntity.setUsermail(user.getUserMail());
					response = insert(bodyEntity);
				}
				break;
			case PUT:
				if (relativePath.isEmpty()) {
					response = update(bodyEntity);
				}
				break;
			case DELETE:
				if (relativePath.matches("\\/\\d+")) {
					Integer itemId = Integer.parseInt(relativePath.substring(1));
					getById(itemId, user); // authorize
					response = remove(itemId);
				}
				break;
			default:
			}

			if (response != null) {
				return ModelAppResponse.responseJSON(mapper.writeValueAsString(response));
			} else {
				throw new WebServerBadRequestException("Unknown request: " + method + " , " + relativePath);
			}

		} catch (Exception e) {
			logger.error("Error occurred.", e);
			return ModelAppResponse.responseError(e);
		}
	}