protected function makeAndBind($var, $key = null)
 {
     $source = DataSource::make($var);
     if ($var instanceof Collection && func_num_args() > 1) {
         $relation = Cache::getRelation($this->getDelegatedStorage(), $key);
         if (!$relation instanceof Relation) {
             throw new \LogicException('Expected Relation, got ' . get_type_class($relation));
         }
         $source->bindToRelation($relation);
     }
     return $source;
 }
 public function save()
 {
     $model = $this->unwrap();
     $modelRelations = Cache::all($model);
     foreach ($modelRelations as $key => $mr) {
         $relation = Rel::make($mr['relation']);
         if ($relation->canSaveBefore()) {
             $relation->saveBefore($mr['child']);
         }
     }
     $model->save();
     foreach ($modelRelations as $key => $model) {
         $relation = Rel::make($mr['relation']);
         if ($relation->canSaveAfter()) {
             $relation->saveAfter($mr['child']);
         }
     }
 }