class DynamoDBWorkerUtils {

    public static String getStoredETag(final AmazonDynamoDB dynamoDB, final String table, final String resource) {
        String oldETag;
        // Build key to retrieve item
        final Map<String, AttributeValue> resourceKey = new HashMap<String, AttributeValue>();
        resourceKey.put(MarsDynamoDBManager.RESOURCE_TABLE_HASH_KEY, new AttributeValue(resource));
        // Get item
        final GetItemResult result = dynamoDB.getItem(table, resourceKey);
        final Map<String, AttributeValue> item = result.getItem();
        if (item != null && item.containsKey(ETAG_KEY)) {
            // Item was found and contains ETag
            oldETag = item.get(ETAG_KEY).getS();
        } else {
            // Item was not found or did not contain ETag
            oldETag = null;
        }
        return oldETag;
    }

    private  DynamoDBWorkerUtils();

}