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());
        }
        public IHttpActionResult AddADocument([FromUri] string user_email, [FromBody] AddDocument document)
        {
            if (IsTokenValid() && authenticationService.IsAllowedToAddDocument(GetTokenUserEmail(), user_email))
            {
                try
                {
                    Document     newDocument      = documentManagementService.Add(user_email, AddDocument.ToEntity(document));
                    BaseDocument modelNewDocument = BaseDocument.ToModel(newDocument);
                    documentLogger.LogModificationToDocument(modelNewDocument.Id);

                    return(CreatedAtRoute("AddDocument", new { useremail = user_email, documentid = modelNewDocument.Id }, modelNewDocument));
                }
                catch (MissingUserException e)
                {
                    return(BadRequest(e.Message));
                }
                catch (Exceptions e)
                {
                    return(BadRequest(e.Message));
                }
            }

            return(Unauthorized());
        }