public int Add(Document document)
 {
     document.DateCreated = DateTime.Now;
     document.LastUpdated = DateTime.Now;
     using (var db = database)
         db.Insert(document);
     return document.Id;
 }
        private Document CreateDocument()
        {
            var document = new Document();
            document.Name = "test";
            document.LastUpdated = DateTime.Now;
            document.DateCreated = DateTime.Now;
            document.Data = "data";

            return document;
        }
 public void Update(Document document)
 {
     document.LastUpdated = DateTime.Now;
     using (var db = database)
         db.Update(document);
 }
 // PUT api/documents/5
 public void Put(int id, Document document)
 {
     document.Id = id;
     documentsRepository.Update(document);
 }
 // POST api/documents
 public int Post(Document document)
 {
     return documentsRepository.Add(document);
 }