docs: protected void decrementBinaryReferenceCount( Object fieldValue,
                                                    Set<BinaryKey> unusedBinaryKeys,
                                                    Set<BinaryKey> usedBinaryKeys) {
          if (fieldValue instanceof List<?>) {
              for (Object value : (List<?>)fieldValue) {
                  decrementBinaryReferenceCount(value, unusedBinaryKeys, usedBinaryKeys);
              }
          } else if (fieldValue instanceof Object[]) {
              for (Object value : (Object[])fieldValue) {
                  decrementBinaryReferenceCount(value, unusedBinaryKeys, usedBinaryKeys);
              }
          } else {
              String sha1 = null;
              if (fieldValue instanceof Document) {
                  Document docValue = (Document)fieldValue;
                  sha1 = docValue.getString(SHA1_FIELD);
              } else if (fieldValue instanceof BinaryKey) {
                  sha1 = fieldValue.toString();
              } else if (fieldValue instanceof org.modeshape.jcr.api.Binary && !(fieldValue instanceof InMemoryBinaryValue)) {
                  sha1 = ((org.modeshape.jcr.api.Binary)fieldValue).getHexHash();
              }
  
              if (sha1 != null) {
                  BinaryKey binaryKey = new BinaryKey(sha1);
                  // Find the document metadata and decrement the usage count ...
                  // Don't acquire a lock since we should've done so at the beginning of the #save method
                  EditableDocument sha1Usage = documentStore.edit(keyForBinaryReferenceDocument(sha1), false);
                  if (sha1Usage != null) {
                      Long countValue = sha1Usage.getLong(REFERENCE_COUNT);
                      assert countValue != null;
  
                      long count = countValue - 1;
                      assert count >= 0;
  
                      if (count == 0) {
                          // We're not using the binary value anymore ...
                          if (unusedBinaryKeys != null) {
                              unusedBinaryKeys.add(binaryKey);
                          }
                          if (usedBinaryKeys != null) {
                              usedBinaryKeys.remove(binaryKey);
                          }
                      }
                      sha1Usage.setNumber(REFERENCE_COUNT, count);
                  } else {
                      // The documentStore doesn't contain the binary ref count doc, so we're no longer using the binary value ...
                      if (unusedBinaryKeys != null) {
                          unusedBinaryKeys.add(binaryKey);
                      }
                      if (usedBinaryKeys != null) {
                          usedBinaryKeys.remove(binaryKey);
                      }
                  }
              }
          }
      }