public Object invokeOnRemoteModel(
      String methodName, Class<?>[] parameterTypes, Object[] parameterValues) throws Exception {
    Object[] remoteParameterValues = new Object[parameterValues.length];

    for (int i = 0; i < parameterValues.length; i++) {
      if (parameterValues[i] != null) {
        remoteParameterValues[i] = ClpSerializer.translateInput(parameterValues[i]);
      }
    }

    Class<?> remoteModelClass = _kaleoTaskAssignmentInstanceRemoteModel.getClass();

    ClassLoader remoteModelClassLoader = remoteModelClass.getClassLoader();

    Class<?>[] remoteParameterTypes = new Class[parameterTypes.length];

    for (int i = 0; i < parameterTypes.length; i++) {
      if (parameterTypes[i].isPrimitive()) {
        remoteParameterTypes[i] = parameterTypes[i];
      } else {
        String parameterTypeName = parameterTypes[i].getName();

        remoteParameterTypes[i] = remoteModelClassLoader.loadClass(parameterTypeName);
      }
    }

    Method method = remoteModelClass.getMethod(methodName, remoteParameterTypes);

    Object returnValue =
        method.invoke(_kaleoTaskAssignmentInstanceRemoteModel, remoteParameterValues);

    if (returnValue != null) {
      returnValue = ClpSerializer.translateOutput(returnValue);
    }

    return returnValue;
  }