public static Object translateInputFeed(BaseModel<?> oldModel) {
    FeedClp oldClpModel = (FeedClp) oldModel;

    BaseModel<?> newModel = oldClpModel.getFeedRemoteModel();

    newModel.setModelAttributes(oldClpModel.getModelAttributes());

    return newModel;
  }
  public static Object translateOutputFeed(BaseModel<?> oldModel) {
    FeedClp newModel = new FeedClp();

    newModel.setModelAttributes(oldModel.getModelAttributes());

    newModel.setFeedRemoteModel(oldModel);

    return newModel;
  }
  public static Object translateInput(BaseModel<?> oldModel) {
    Class<?> oldModelClass = oldModel.getClass();

    String oldModelClassName = oldModelClass.getName();

    if (oldModelClassName.equals(FeedClp.class.getName())) {
      return translateInputFeed(oldModel);
    }

    return oldModel;
  }
  public static Object translateOutput(BaseModel<?> oldModel) {
    Class<?> oldModelClass = oldModel.getClass();

    String oldModelClassName = oldModelClass.getName();

    if (oldModelClassName.equals("com.liferay.twitter.model.impl.FeedImpl")) {
      return translateOutputFeed(oldModel);
    } else if (oldModelClassName.endsWith("Clp")) {
      try {
        ClassLoader classLoader = ClpSerializer.class.getClassLoader();

        Method getClpSerializerClassMethod = oldModelClass.getMethod("getClpSerializerClass");

        Class<?> oldClpSerializerClass = (Class<?>) getClpSerializerClassMethod.invoke(oldModel);

        Class<?> newClpSerializerClass = classLoader.loadClass(oldClpSerializerClass.getName());

        Method translateOutputMethod =
            newClpSerializerClass.getMethod("translateOutput", BaseModel.class);

        Class<?> oldModelModelClass = oldModel.getModelClass();

        Method getRemoteModelMethod =
            oldModelClass.getMethod("get" + oldModelModelClass.getSimpleName() + "RemoteModel");

        Object oldRemoteModel = getRemoteModelMethod.invoke(oldModel);

        BaseModel<?> newModel = (BaseModel<?>) translateOutputMethod.invoke(null, oldRemoteModel);

        return newModel;
      } catch (Throwable t) {
        if (_log.isInfoEnabled()) {
          _log.info("Unable to translate " + oldModelClassName, t);
        }
      }
    }

    return oldModel;
  }