private void CreateCollectionIfRequired()
{
if (this.ShouldCreateCollection())
{
try
{
string collectionId = string.Format("{0}{1}", this.CollectionIdPrefix, NextCollectionNumber);
var createdCollection = DocumentClientHelper.GetCollectionAsync(this.Client, this.Database, collectionId, this.CollectionTemplate).Result;
this.CollectionLinks.Add(createdCollection.SelfLink);
}
catch
{
this.CollectionLinks = GetCollections(this.Client, this.Database, this.CollectionIdPrefix,
this.CollectionTemplate);
}
}
}