/**
* @param DeleteGroup $command
* @return \Flarum\Core\Group
* @throws PermissionDeniedException
*/
public function handle(DeleteGroup $command)
{
$actor = $command->actor;
$group = $this->groups->findOrFail($command->groupId, $actor);
$this->assertCan($actor, 'delete', $group);
$this->events->fire(new GroupWillBeDeleted($group, $actor, $command->data));
$group->delete();
$this->dispatchEventsFor($group, $actor);
return $group;
}