[Connect C++] Attach raster in a specified Z-coordinate

I've created a function that I use to attach a rasterfile and put it in a specified Z.coordinate:

void lifalib_attachRasterFile(WCharCP wcRasterFileNameP, WCharCP wcLogicalNameP, WCharCP wcDescriptionP, UInt32 lvIdForRaster, double defaultPrio)
{
	ElementId rtValue = 0;

	DgnDocumentMonikerPtr moniker = DgnDocumentMoniker::CreatePortableMoniker(NULL, wcRasterFileNameP, NULL, NULL, NULL, DgnPlatform::RelativePathPreference::CreateIfPossible);

	DgnRasterStatus status;
	DgnRasterOpenParamsPtr openParams = DgnRasterOpenParams::Create(moniker, true);

	DgnRasterPtr rasterPtr = DgnRaster::Create(status, *openParams, *ISessionMgr::GetActiveDgnModelRefP());
	rasterPtr->SetLogicalName(wcLogicalNameP);
	rasterPtr->SetDescription(wcDescriptionP);
	rasterPtr->SetLevel(lvIdForRaster);

	// if we are working in a 3D file then put the rasterref. in the specified Z-position
	if (ISessionMgr::GetActiveDgnModelRefP()->Is3d())
	{
		Transform trf = rasterPtr->GetTransform();
		Dpoint3d ptdTrf;
		trf.GetTranslation(ptdTrf);
		ptdTrf.z = defaultPrio * SCALE;
		trf.SetTranslation(ptdTrf);
		rasterPtr->SetTransform(trf);
	}

	// save rasterref. in model
	rasterPtr->AddToModel();
}

We normally set the defaultPrio parameter to a value less than zero so that the raster can be seen as background behind the vector elements.

This works fine with "static" rasterfiles (.png, .jpg files etc.) and for WMS raster (.xwms files).

My problem occurs when I close the designfile and opens it again. Then the Z-value is still OK for the "static" rasterfiles but for the WMS raster the Z-value is zero. What can I do to "save" the correct Z-value ?

Best regards,

Evan