@Override
	public CategoryModel addCategory(CategoryModel category)
			throws WebshopAppException {

		if (isValidCategory(category, "ADD_CATEGORY")) {
			try (Connection conn = getConnection()) {

				String sql = "INSERT INTO categories (name, staff_responsible)"
						+ "VALUES (?, ?)";

				try (PreparedStatement pstmt = conn.prepareStatement(sql,
						Statement.RETURN_GENERATED_KEYS)) {

					prepareStatementFromModel(pstmt, category);

					pstmt.executeUpdate();

					int generatedId = CategoryModel.DEFAULT_ID;
					try (ResultSet rs = pstmt.getGeneratedKeys()) {
						if (rs.next()) {
							generatedId = rs.getInt(1);
						}
					}

					CategoryModel newModel = new CategoryModel(generatedId,
							category);

					Log.logOut(LOGGER, this, "ADD_CATEGORY",
							"Category inserted: ", newModel.toString());

					return newModel;

				}

			} catch (SQLException e) {
				WebshopAppException excep = new WebshopAppException(e, this
						.getClass().getSimpleName(), "ADD_CATEGORY");

				Log.logOutWAException(LOGGER, excep);

				throw excep;
			}
		}

		return null;
	}