public boolean updateArticlesGroup(ArticlesGroup group) throws DatabaseException, SQLException {
		ArticlesGroupValidator validator = new ArticlesGroupValidator();
		if (validator.validate(group)) {
			try {
				DatabaseManager.getInstance().startTransaction();
				String query = "UPDATE GrupyTowarowe "
						+ "SET Nazwa='" + group.getName() + "', VAT=" + group.getVat().getId() + " "
						+ "WHERE KodGrupy=" + group.getCode() + ";";
				DatabaseManager.getInstance().executeQuery(query);
				StringBuilder groupAttributesIds = new StringBuilder();
				if (!group.getAttributes().isEmpty()) {
					for (ArticleAttribute attribute : group.getAttributes()) {
						groupAttributesIds.append(attribute.getId()).append(", ");

					}
					groupAttributesIds.setLength(groupAttributesIds.length() - 2);
				}
				query = "SELECT IdAtrybutuGrupy "
						+ "FROM AtrybutyGrup "
						+ "WHERE KodGrupy=" + group.getCode();
				if (!"".equals(groupAttributesIds.toString())) {
					query += " AND IdAtrybutu NOT IN (" + groupAttributesIds.toString() + ")";
				}
				query += ";";
				List<ResultRow> resultRows = DatabaseManager.getInstance().executeQueryResult(query);
				for (ResultRow row : resultRows) {
					query = "DELETE FROM AtrybutyGrup "
							+ "WHERE IdAtrybutuGrupy=" + row.getInt(1);
					DatabaseManager.getInstance().executeQuery(query);
				}
				if (!"".equals(groupAttributesIds.toString())) {
					query = "SELECT IdAtrybutu "
							+ "FROM AtrybutyCzesci "
							+ "WHERE IdAtrybutu NOT IN(SELECT IdAtrybutu FROM AtrybutyGrup WHERE KodGrupy=" + group.getCode() + ")"
							+ "AND IdAtrybutu IN (" + groupAttributesIds + ");";
					resultRows = DatabaseManager.getInstance().executeQueryResult(query);
					for (ResultRow row : resultRows) {
						query = "INSERT INTO AtrybutyGrup (KodGrupy, IdAtrybutu) "
								+ "VALUES(" + group.getCode() + ", " + row.getInt(1) + ");";
						DatabaseManager.getInstance().executeQuery(query);
					}
				}
				DatabaseManager.getInstance().commitTransaction();
			}
			catch (SQLException ex) {
				DatabaseManager.getInstance().rollbackTransaction();
				throw ex;
			}
		}
		return true;
	}