private function resolveCast($old, $desired, Model $model, &$transformed)
    {
        if ($desired instanceof Closure) {
            return $transformed[$old] = call_user_func($desired, $model);
        }

        if (is_string($desired) && strpos($desired, $this->functionSign) !== false) {
            return $transformed[$old] = call_user_func([$this, substr($desired, 1)], $model);
        }

        if (is_string($desired) && strpos($desired, $this->querySign) !== false) {
            return $this->parse($old, substr($desired, 1), $model, $transformed);
        }

        if (is_string($old)) {
            return $transformed[$desired] = $model->$old;
        }

        return $transformed[$desired] = $model->$desired;
    }