class CategoriesService extends ConfigurationService<Categories> {

	public void create(Category category) {
		validateNotNull(category, "Must provide a category.");
		validateRequired(category.getName(), "Category name");

		String name = category.getName().trim();
		Categories categories = retrieve();
		validate(categories.getCategoryByName(name) == null,
				format("Category with name \"{0}\" cannot be created since a category with the same name already exists.",
						name));

		Categories newCategories = new Categories(
				ImmutableList.<Category> builder().addAll(categories.getCategories()).add(new Category(name)).build());
		update(newCategories);
	}

	@Inject  CategoriesService(CategoriesPersistenceService persistenceService, EntityEventSupport eventSupport);

}