public function addToGroupByCode($groupcode, $title = "")
    {
        $group = DataObject::get_one(Group::class, array(
            '"Group"."Code"' => $groupcode
        ));

        if ($group) {
            $this->Groups()->add($group);
        } else {
            if (!$title) {
                $title = $groupcode;
            }

            $group = new Group();
            $group->Code = $groupcode;
            $group->Title = $title;
            $group->write();

            $this->Groups()->add($group);
        }
    }