protected function buildAttachRecords($roleIds, $morphType, $authorityIds)
    {
        return $roleIds->map(function ($roleId) use ($morphType, $authorityIds) {
            return $authorityIds->map(function ($authorityId) use ($roleId, $morphType) {
                return Models::scope()->getAttachAttributes() + [
                    'role_id' => $roleId,
                    'entity_id' => $authorityId,
                    'entity_type' => $morphType,
                ];
            });
        })->collapse();
    }