code: @SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
      private C4Document save(Document document, C4Document base, boolean deletion)
          throws LiteCoreException {
          FLSliceResult body = null;
          try {
              int revFlags = 0;
              if (deletion) { revFlags = C4Constants.RevisionFlags.DELETED; }
              if (!deletion && !document.isEmpty()) {
                  // Encode properties to Fleece data:
                  body = document.encode();
                  if (C4Document.dictContainsBlobs(body, sharedKeys.getFLSharedKeys())) {
                      revFlags |= C4Constants.RevisionFlags.HAS_ATTACHMENTS;
                  }
              }
  
              // Save to database:
              final C4Document c4Doc = base != null ? base : document.getC4doc();
              if (c4Doc != null) { return c4Doc.update(body, revFlags); }
  
              return getC4Database().create(document.getId(), body, revFlags);
          }
          finally {
              if (body != null) { body.free(); }
          }
      }
docs: Lower-level save method. On conflict, returns YES but sets *outDoc to NULL.