Change custom properties then rebuild without opening the file twice.

Using C# I'm opening a document to change some custom properties:

Open:

  uSwDoc = (SwDMDocument)uSwDocMgr.GetDocument(uSDocFileName, uNDocType, false, out uNRetVal);

Change Properties:

  uSwDoc.SetCustomProperty(row["PropName"].ToString(),row["PropValue"].ToString());

Then I need to rebuild the model.

Currently I do it this way:

            uSwDoc.Save();

            uSwDoc.CloseDoc();

            uModDoc = (ModelDoc2)uSldWorks.OpenDoc6(uSDocFileName, (int)uNDocType, 1, "", ref Errors, ref Warnings);

            uModDoc.Rebuild(1);

            uModDoc.Save3(1, ref Errors, ref Warnings);

            uSldWorks.CloseDoc(uSDocFileName);

Am I able to rebuild the document while my uSwDoc already has it opened instead of opening, saving and closing it twice?

Thanks!

SolidworksApi macros