protected Type toUnwrappedModel(Type type) {
    if (type instanceof TypeImpl) {
      return type;
    }

    TypeImpl typeImpl = new TypeImpl();

    typeImpl.setNew(type.isNew());
    typeImpl.setPrimaryKey(type.getPrimaryKey());

    typeImpl.setTypeId(type.getTypeId());
    typeImpl.setGroupId(type.getGroupId());
    typeImpl.setName(type.getName());

    return typeImpl;
  }