public function updateById($id, $attributes)
    {
        $attributes = $this->formatUpdateAttributes($attributes);

        $model = $this->model->find($id);

        if (empty($model))
            return $this;

        $model->update($this->mapAttributesWithScope($attributes));

        $apiModel = $this->getById($model->id);
        $this->afterUpdate($apiModel, $attributes);
        return $apiModel;
    }