public function edit(ServerRequestInterface $request)
    {
        if ($this->isReadOnly()) {
            return new NotFoundStatusResponse();
        }

        if ($this->active_object && $this->active_object->isLoaded()) {
            $authenticated_user = $this->getAuthenticatedUser($request);

            if ($this->shouldCheckPermissions() && !$this->canEdit($this->active_object, $authenticated_user)) {
                return new ForbiddenStatusResponse();
            }

            $request_body = $request->getParsedBody();

            if (empty($request_body)) {
                $request_body = [];
            }

            if ($this->requestBodyContainsProtectedFields($this->active_object, $request_body)) {
                return new BadRequestStatusResponse();
            }

            $this->cleanUpRequestBodyForEdit($request_body, $authenticated_user);

            try {
                return $this->pool->modify($this->active_object, $request_body);
            } catch (ValidationException $e) {
                return $e;
            }
        } else {
            return new NotFoundStatusResponse();
        }
    }