docs: @Override
      public void writeTo(Object obj, Class<?> type, Type genericType, Annotation[] anns, MediaType mt,
                          MultivaluedMap<String, Object> headers, OutputStream os) throws IOException, WebApplicationException { // TODO Auto-generated method stub
          //Convert object if contains AttachmentImpl/MultiBodyImpl.
          if (Map.class.isAssignableFrom(obj.getClass())) {
              Map<Object, Object> objects = CastUtils.cast((Map<?, ?>) obj);
              for (Iterator<Map.Entry<Object, Object>> iter = objects.entrySet().iterator(); iter.hasNext();) {
                  Map.Entry<Object, Object> entry = iter.next();
                  Object value = entry.getValue();
                  if (value != null && AttachmentImpl.class.isAssignableFrom(value.getClass())) {
                      entry.setValue(((AttachmentImpl) value).getAttachment());
                  }
              }
          } else if (List.class.isAssignableFrom(obj.getClass())) {
              List<Object> objects = (List<Object>) obj;
              for (int i = 0; i < objects.size(); i++) {
                  if (objects.get(i) != null && AttachmentImpl.class.isAssignableFrom(objects.get(i).getClass())) {
                      Attachment a = ((AttachmentImpl) objects.get(i)).getAttachment();
                      objects.set(i, a);
                  }
              }
  
          } else if (MultipartBodyImpl.class.isAssignableFrom(obj.getClass())) {
              obj = ((MultipartBodyImpl) obj).getMultipartBody();
          } else if (AttachmentImpl.class.isAssignableFrom(obj.getClass())) {
              obj = ((AttachmentImpl) obj).getAttachment();
          }
          //convert type/genericType
          if (type.equals(AttachmentImpl.class)) {
              type = Attachment.class;
          } else if (type.equals(MultipartBodyImpl.class)) {
              type = MultipartBody.class;
          }
          if (genericType.equals(AttachmentImpl.class)) {
              genericType = Attachment.class;
          } else if (genericType.equals(MultipartBodyImpl.class)) {
              genericType = IMultipartBody.class;
          }
  
          this.multipartProvider.writeTo(obj, type, genericType, anns, mt, headers, os);
  
      }