public IHttpActionResult Update([FromUri] Guid document_id, [FromBody] UpdateDocument document) { if (IsTokenValid() && authenticationService.IsAllowedToUpdateDocument(GetTokenUserEmail(), document_id)) { try { documentManagementService.Update(document_id, UpdateDocument.ToEntity(document)); documentLogger.LogModificationToDocument(document_id); return(Ok(document_id)); } catch (MissingDocumentException e) { return(BadRequest(e.Message)); } catch (Exceptions e) { return(BadRequest(e.Message)); } } return(Unauthorized()); }