public function bulkDelete(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('Permissions', 'delete')) {
            return $this->noPermission();
        }
        $data = $request->all();
        if(isset($data['postTypes'])) {
            unset($data['postTypes']);
        }

        DB::statement('SET FOREIGN_KEY_CHECKS=0');
        foreach ($data as $id){
            $page = \App\Models\UserGroup::findOrFail($id)->delete();
            if (!$page) {
                return $this->response('Internal server error. Please try again later', 500);
            }
            DB::table('permissions')->where('groupID', $id)->delete();
        }

        return $this->response('Groups are deleted');
    }