How do I get layers (OCG-s) on a page level (vs. document level)?

Q: When a pdf document has more than one page, we need to know the
layers per page. So far we have only been able to determine all the
layers in the document and not the ones per page. We are using
something like this to get the layer count:

        int nLayers = 0;
        Obj ocgs = m_pPdfDoc->GetOCGs();
        if (ocgs != 0 && m_pPdfDoc->HasOC())
            nLayers = int(ocgs.Size());

Is there a mechanism for getting the layers per page?
A: You can access Layers (i.e. OCG-s) used on a given page through
'Properties' dictionary which is part of page resource dictionary.

For example:

// C# pseudocode ---

Page pg = pdfdoc.GetPage(1);

Obj props = pg.GetResourceDict().FindObj("Properties");
if (props != ) {
  DictIterator itr = props.GetDictIterator();
  while (itr.HasNext()) {
    Obj value = itr.Value();
    pdftron.PDF.OCG ocg = new pdftron.PDF.OCG.Group();
    if (IsValid()) {
      ... use ocg
    else {
      pdftron.PDF.OCMD ocmd = new pdftron.PDF.OCMD();
      if (ocmd.IsValid()) {
        ... use optional content membership dictionary (ocmd) ...