protected function fill(Model $instance): bool
	{
		$input = $this->getInput();
		$model_fields = $this->getFields($instance);
		$before_relations = [];
		$after_relations = [];
		$instance_model = get_class($instance);
		$safe_instance = new $instance_model;

		$input = ($safe_instance->getIncrementing()) ? array_except($input, [$instance->getKeyName()]) : $input;

		foreach ($input as $key => $value) {
			if (($relation = $this->isRelation($instance, $key, $instance_model)) && $this->isFillable($key)) {
				$relation_type = get_class($relation);

				switch ($relation_type) {
					case BelongsTo::class:
						$before_relations[] = [
							'relation' => $relation,
							'value' => $value,
						];
						break;
					case HasOne::class:
					case HasMany::class:
					case BelongsToMany::class:
						$after_relations[] = [
							'relation' => $relation,
							'value' => $value,
						];
						break;
				}
			} elseif ((in_array($key, $model_fields) || $instance->hasSetMutator($key)) && $this->isFillable($key)) {
				$instance->{$key} = $value;
			}
		}

		unset($safe_instance);

		$this->applyRelations($before_relations, $instance);
		$instance->save();
		$this->applyRelations($after_relations, $instance);

		return true;
	}