NC 12 - how to create group, add user to group

We have this php code, which worked in Nextcloud versions prior to 12, to create a group and add a user to a group:

if(!OC_Group::groupExists($group)) {

if(!OC_Group::inGroup($username,$group)) {

but this no longer works in Nextcloud 12. Can someone tell me how to perform the same operations in Nextcloud 12?

i also have same problem as you. Please help me.