public static boolean save(
        ContentResolver resolver, Capsule capsule, CapsuleContract.SyncStateAction syncAction) {
      // Build the ContentProviderOperations for the save
      CapsuleOperations operations = new CapsuleOperations(resolver);
      operations.buildOwnershipSave(capsule, syncAction);

      // Apply the batch operation
      ContentProviderResult[] results = operations.applyBatch();

      // Make sure the rows were properly updated
      boolean success = true;

      // Check the first result (Capsule operation)
      if (results[0].uri != null) {
        // The Capsule operation was an INSERT, so parse the ID from the URI
        capsule.setId(ContentUris.parseId(results[0].uri));
      } else {
        // The Capsule operation was an UPDATE, so make sure a row was updated
        if (results[0].count < 1) {
          success = false;
        }
      }

      // Check the second result (Ownership operation)
      if (results[1].uri != null) {
        // The Ownership operation was an INSERT, so parse the ID from the URI
        ((CapsuleOwnership) capsule).setOwnershipId(ContentUris.parseId(results[1].uri));
      } else {
        // The Ownership operation was an UPDATE, so make sure a row was updated
        if (results[1].count < 1) {
          success = false;
        }
      }

      return success;
    }