This has been discussed in the past in the following tickets:
Q434237
Q455456
Q473657
Q359904
Q485094
etc.
Currently, to edit certain properties in code, you can manually create an XPObjectSpaceProvider object by passing the connection string to the database into it, and then using its CreateObjectSpace method to create an IObjectSpace object to manager your data bypassing all the security:
C#XPObjectSpaceProvider provider = new XPObjectSpaceProvider(<connectiostring>, null);
IObjectSpace os = provider.CreateObjectSpace();