@Override
	public ProductModel createProduct(ProductModel product)
			throws WebshopAppException {
		int generatedId = ProductModel.DEFAULT_PRODUCT_ID;
		if (isValidProduct(product, "CREATE_PRODUCT")) {
			try (Connection conn = getConnection()) {

				conn.setAutoCommit(false);
				try {
					generatedId = insertProduct(conn, product);

					conn.commit();

				} catch (SQLException e) {
					rollback(conn);
					throw e;
				}

			} catch (SQLException e2) {
				WebshopAppException excep = new WebshopAppException(e2, this
						.getClass().getSimpleName(), "CREATE_PRODUCT");
				Log.logOutWAException(LOGGER, excep);
				throw excep;
			}
		}

		ProductModel newProduct = ProductModel
				.builder(product.getName(), product.getProductType())
				.id(generatedId).description(product.getDescription())
				.cost(product.getCost()).rrp(product.getRrp())
				.categories(product.getCategories()).build();

		Log.logOut(LOGGER, this, "CREATE_PRODUCT", "Product created:",
				newProduct.toString());

		return newProduct;
	}