code: public synchronized <T> T removeAttachment(final AttachmentKey<T> key) {
          if (key == null) {
              return null;
          }
          return key.cast(attachments.remove(key));
      }
docs: {@inheritDoc}