class TransactionsWebService {

	@PUT
	@Path("{transactionId}/category")
	public void putCategory(@PathParam("transactionId") String transactionId, CategoryModel category) {
		validateRequired(transactionId, "Transaction id");
		validateNotNull(category, "Category must be provided.");
		validateRequired(category.getName(), "Category name");

		Transactions transactions = transactionsService.retrieve();
		Transaction transaction = transactions.byId(transactionId);
		validate(transaction != null, format("Transaction with id \"{0}\" not found.", transactionId));

		Transaction categorized = transaction.withCategoryName(category.getName());

		transactionsService.update(transactions.copyWithReplacement(categorized));
	}

	@Inject  TransactionsWebService(TransactionsService transactionsService);

}