public BsonDocument Serialize(Commit commit)
        {
            if (commit == null) throw new ArgumentNullException(nameof(commit));

            return new BsonDocument
            {
                {StreamIdFieldName, commit.StreamId},
                {IndexInStreamFieldName, commit.IndexInStream},
                {IndexInAllStreamsFileName, commit.IndexInAllStreams},
                {EventIndexInStreamFieldName, commit.EventIndexInStreamStartsFrom},
                {EventIndexInAllStreamsFieldName, commit.EventIndexInAllStreamsStartsFrom},
                {EventIdsFieldName, new BsonArray(commit.EventIds)}
            };
        }
 private async Task<InsertCommitResult> TryInsertAsync(Commit commit)
 {
     var commitDocument = _commitSerializer.Serialize(commit);
     return await _commitDao.InsertAsync(commitDocument);
 }