public static function castModel(ActiveRecord $model)
{
$attributes = array_merge($model->getAttributes(), $model->getRelatedRecords());
$results = [];
foreach ($attributes as $key => $value) {
$results[Caster::PREFIX_VIRTUAL . $key] = $value;
}
return $results;
}