protected function saving(Eloquent $role, $input = [], $type = 'create')
    {
        $beforeEvent = ($type === 'create' ? 'creating' : 'updating');
        $afterEvent = ($type === 'create' ? 'created' : 'updated');

        $role->setAttribute('name', $input['name']);

        $this->fireEvent($beforeEvent, [$role]);
        $this->fireEvent('saving', [$role]);

        DB::transaction(function () use ($role) {
            $role->save();
        });

        $this->fireEvent($afterEvent, [$role]);
        $this->fireEvent('saved', [$role]);

        return true;
    }