code: public void uploadAttachment(RepositoryResourceImpl resource, AttachmentResourceImpl attachment,
                                   RepositoryResourceImpl matchingResource) throws RepositoryResourceCreationException, RepositoryBadDataException, RepositoryResourceUpdateException, RepositoryBackendException, RepositoryResourceException {
          switch (attachment.updateRequired(matchingResource)) {
              case ADD:
                  resource.addAttachment(attachment);
                  break;
              case UPDATE:
                  resource.updateAttachment(attachment);
                  break;
              case NOTHING:
                  // Nothing to do but have to include this to stop findbugs crying
                  break;
          }
      }
docs: Goes through each attachment and adds/updates the attachment as needed.
  
  @throws RepositoryResourceException
  @throws RepositoryBackendException
  @throws RepositoryResourceUpdateException
  @throws RepositoryBadDataException
  @throws RepositoryResourceCreationException