Mate flipping via API

I need to flip some mate programatically. For it I found some example (that I actually use) - this is based on selection of three objects: mate entity1, mate entity2 and mate plus calling AssemblyDoc method EditMate2 with the right parameters. This code works but I don't like it (it needs a lot of API calls etc.). I found that there are two interesting mates properties in API: CanBeFlipped and Flipped. I found that in any case the CanBeFlipped is set to false and therefore setting of Flipped property has no effect. Funny is that although the CanBeFlipped is set to false, code mentioned above works;-)

Can anybody give me an advice how to make it better?

SolidworksApi macros