public T Insert(T entity) { if (entity == null) { throw new ArgumentException("entity"); } if (entity.Id == null || entity.Id == Guid.Empty) { entity.Id = Guid.NewGuid(); } entity = audit.StampCreated(entity); entities.InsertOne(entity); return(entity); }