class ItemMapper {

    public Item fromByteBuffer(ByteBuffer byteBuffer) {
        try {
            JsonNode node = objectMapper.readTree(byteBuffer.array());
            ZonedDateTime dateTime = ZonedDateTime.parse(node.get(PERIOD_TABLE_RANGE_KEY).asText(), AWS_DATE_TIME);

            PrimaryKey key = key(node);

            Item item = new Item().withPrimaryKey(key);


            Iterator<Map.Entry<String, JsonNode>> iterator = node.fields();
            while (iterator.hasNext()) {
                Map.Entry<String, JsonNode> entry = iterator.next();
                if (!entry.getKey().equals(CAMPAIGN_TABLE_HASH_KEY) &&
                    !entry.getKey().equals(PERIOD_TABLE_RANGE_KEY)) {

                    if (entry.getValue().isBoolean()) {
                        item = item.withBoolean(entry.getKey(), entry.getValue().asBoolean());
                    } else if (entry.getValue().isInt()) {
                        item = item.withInt(entry.getKey(), entry.getValue().asInt());
                    } else if (entry.getValue().isLong()) {
                        item = item.withLong(entry.getKey(), entry.getValue().asLong());
                    } else if (entry.getValue().isDouble()) {
                        item = item.withDouble(entry.getKey(), entry.getValue().asDouble());
                    } else if (entry.getValue().isFloat()) {
                        item = item.withFloat(entry.getKey(), entry.getValue().floatValue());
                    } else if (entry.getValue().isTextual()) {
                        item = item.withString(entry.getKey(), entry.getValue().asText());
                    }

                }
            }
            return item;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

}