public function patch(Request $request, Fractal $fractal, InputGateContract $inputGate)
    {
        $this->beforeRequest($request, func_get_args());
        $id = $this->parseObjectId($request);
        $model = $this->loadAuthorizeObject($id, 'update');
        $input = $request->json()->all();
        if (!is_array($input) || empty($input)) {
            throw new UnprocessableEntityHttpException("Invalid request body");
        }
        $attributes = $originalAttributes = array_get($input, 'data.attributes', []);
        $context = app('context');
        foreach ($context as $key => $value) {
            unset($attributes[$key]);
        }
        $relationships = array_get($input, 'data.relationships', []);
        $attributes = $inputGate->process($model, $attributes, 'update');
        $validatedRelationshipData = $this->validateRelationshipData($model, $relationships, 'update');
        // do update logic
        if ($model->update($attributes) && $this->saveRelationshipData($validatedRelationshipData)) {
            return $this->respondWithUpdated(
                $fractal->createData(new FractalItem($this->loadAuthorizeObject($id, 'update'), $this->getTransformer(), $this->getResourceKey()))
            );
        }
        
        throw new ServerErrorHttpException("Unable to save object. Try again later.");
    }