According to PDF specs, it is possible to create OC Groups with the same name. Their visibility should be determined using object references (object number and generation number). The current implementation of PDOptionalContentProperties does not allow to create and check visibility of two different groups with the same name because all checks are done using group name, not group object key.
Provided PDF demonstrates this issue.
The attached patch adds an ability to use PDOptionalContentGroup as key to check and set group visibility.