public static function removeGroupContent(NodeInterface $node, Group $group) {
    // Try to load group content from entity.
    if ($group_contents = GroupContent::loadByEntity($node)) {
      /* @var @param \Drupal\group\Entity\GroupContent $group_content */
      foreach ($group_contents as $group_content) {
        if ($group->id() === $group_content->getGroup()->id()) {
          $group_content->delete();
        }
      }
    }
  }
public static function removeGroupContent(NodeInterface $node, Group $group) {
    // Try to load group content from entity.
    if ($group_contents = GroupContent::loadByEntity($node)) {
      /* @var @param \Drupal\group\Entity\GroupContent $group_content */
      foreach ($group_contents as $group_content) {
        if ($group->id() === $group_content->getGroup()->id()) {
          $group_content->delete();
        }
      }
    }
  }
public static function removeGroupContent ( NodeInterface $ node , Group $ group ) { // Try to load group content from entity. if ( $ group_contents = GroupContent :: loadByEntity ( $ node ) ) { /* @var @param \Drupal\group\Entity\GroupContent $group_content */ foreach ( $ group_contents as $ group_content ) { if ( $ group -> id ( ) === $ group_content -> getGroup ( ) -> id ( ) ) { $ group_content -> delete ( ) ; } } } }
Deletes a group content.

@param \Drupal\node\NodeInterface $node
Object of a node.
@param \Drupal\group\Entity\Group $group
Object of a group.
Deletes a group content .