private void HandleStreamingCollections(string type, JObject data)
{
var collectionResult = data.ToObject<CollectionResult>(JsonSerializer);
if (collectionResult.Name == null)
{
return;
}
var collection = _collectionDatabase.GetOrAddCollection(collectionResult.Name);
switch (type)
{
case "added":
collection.Added(collectionResult.Id, collectionResult.Fields);
break;
case "changed":
collection.Changed(collectionResult.Id, collectionResult.Fields);
break;
case "removed":
collection.Removed(collectionResult.Id);
break;
default:
throw new InvalidOperationException($"Encountered a unknown subscription update type {type}.");
}
}