public function cast($model)
    {
        if ($model instanceof Collection) {
            return $model->map([$this, 'cast'])->toArray();
        }

        if (empty($model)) {
            return;
        }

        $transformed = [];

        foreach ($this->castRules() as $old => $desired) {
            $this->resolveCast($old, $desired, $model, $transformed);
        }

        return $transformed;
    }