[CE U16 C++] Handle unsaved references - mdlWorkDgn_discardFile

Hi, everyone

in my scenarion the automatic save (MS_DGNAUTOSAVE) is deactivated. Now I'm activating a reference, change it and deactivate it. The reference has now pending changes. If I close MicroStation I get the question if I would save the change to the reference, undo the change or cancel the closing process. I want to code the same question for my own functions but don't know how. I thought it could go like this: (Code simplified)

mdlModelRefIterator_create(&mrIterator, modelP, MRITERATE_Root | MRITERATE_PrimaryChildRefs, 0);
while (NULL != (modelP = mdlModelRefIterator_getNext(mrIterator)))
{
    DgnFileP pRefFile = NULL;
    pRefFile = mdlModelRef_getDgnFile(modelP);
    if (pRefFile && TRUE == mdlDgnFileObj_hasPendingChanges(pRefFile))
    {
      if (Save)
      {
        iRet = mdlWorkDgn_saveChanges(modelP);
      }
      else
      {
        iRet = mdlWorkDgn_discardFile(modelP);
      }
    }
}
mdlModelRefIterator_free(&mrIterator);

mdlWorkDgn_saveChanges works fine but mdlWorkDgn_discardFile does not. I tried to reload the changed reference but then MicroStation comes in with the same question again (Save/Undo/Cancel). Do I have to call another function after discardFile?

Thanks
Marcel