public IActionResult GetArchive(string archiveId)
        {
            ObjectId id = new ObjectId(archiveId);

            Models.Archive result = db.GetArchive(id);
            return(new ObjectResult(result.ToViewModel()));
        }
        public IActionResult AddArchive([FromBody] ViewModels.Archive data)
        {
            Models.Archive newArchive = data.FromViewModel();

            // first add the collection.
            ViewModels.Collection c = data.Collection;

            Models.Collection dbCollection = null;

            if (!string.IsNullOrEmpty(c.Id))
            {
                dbCollection = db.GetCollection(new ObjectId(c.Id));
            }
            else
            {
                // try to find it by searching other fields.
                dbCollection = db.GetCollection(c.StartDate, c.EndDate, c.Name);
            }
            if (dbCollection == null)
            {
                Models.Collection newCollection = c.FromViewModel();

                dbCollection = db.CreateCollection(newCollection);
            }

            if (dbCollection != null)
            {
                newArchive.Collection = dbCollection;
            }

            db.CreateArchive(newArchive);

            return(new ObjectResult(newArchive.ToViewModel()));
        }