public function afterSave($project, $attributes)
    {
        // if "relation" is not present in the input, we simply detach all
        // related models by passing an empty array.
        $ids = isset($attributes['relation']) ? $attributes['relation'] : [];
        $project->manyToManyRelation()->sync($ids);
    }