private async Task VerifyAllPartitionsExistAsync()
        {
            var shouldWriteToTable = false;

            // Check local list of Partition Schemas against the list of partition keys in _table Context
            for (var i = 0; i < IndexDefinitions.Count; i++)
            {
                var schema = IndexDefinitions[i];
                if (_partitionMetaDataEntityWrapper.DomainObjectInstance.PartitionKeys.Contains(schema.IndexNameKey))
                {
                    continue;
                }
                _partitionMetaDataEntityWrapper.DomainObjectInstance.PartitionKeys.Add(schema.IndexNameKey);
                if (!IndexNameKeysInTable.Contains(schema.IndexNameKey))
                {
                    IndexNameKeysInTable.Add(schema.IndexNameKey);
                }
                shouldWriteToTable     = true;
                _needToRunTableIndices = true;
            }
            if (shouldWriteToTable)
            {
                await _tableMetaDataContext.InsertOrReplaceAsync(_partitionMetaDataEntityWrapper).ConfigureAwait(false);
            }
        }
        private void LoadTableMetaData()
        {
            // Try to load the partition meta data from the existing table (which contains a list of the partition keys in the table).
            _partitionMetaDataEntityWrapper = _tableMetaDataContext.Find(CtConstants.TableMetaDataPartitionKey, CtConstants.PartitionSchemasRowKey);

            // Set the default PartitionKey using the combination below in case there are more than one CloudTableContext objects
            // on the same table.
            _defaultIndexDefinitionName = $"DefaultIndex_ofType_{typeof(TDomainEntity).Name}";
            if (_partitionMetaDataEntityWrapper != null)
            {
                /* This is going through and populating the local PartitionKeysInTable property with the list of keys retrieved
                 * from the Azure table.
                 * This also checks to see if there is a PartitionKey for the table meta data and the DefaultPartition
                 * and adds that if there isn't*/
                var metaDataPkIsInList = false;
                foreach (var partitionKeyString in _partitionMetaDataEntityWrapper.DomainObjectInstance.PartitionKeys)
                {
                    if (partitionKeyString == CtConstants.TableMetaDataPartitionKey)
                    {
                        metaDataPkIsInList = true;
                    }
                    var isInList = false;
                    foreach (var item in IndexNameKeysInTable)
                    {
                        if (item == partitionKeyString)
                        {
                            isInList = true;
                        }
                    }
                    if (!isInList)
                    {
                        IndexNameKeysInTable.Add(partitionKeyString);
                    }
                }
                if (!metaDataPkIsInList)
                {
                    IndexNameKeysInTable.Add(CtConstants.TableMetaDataPartitionKey);
                }

                // The RowKey for the DefaultSchema is set by the given ID property of the TDomainEntity object
                DefaultIndex = CreateIndexDefinition(_defaultIndexDefinitionName)
                               .DefineIndexCriteria(entity => true)
                               .SetIndexedPropertyCriteria(entity => entity.GetType().Name); // Enables searching directly on the type.
                if (IndexDefinitions.All(indexDefinition => indexDefinition.IndexNameKey != DefaultIndex.IndexNameKey))
                {
                    AddIndexDefinition(DefaultIndex);
                }
            }
            else
            {
                /* Creates a new partition meta data entity and adds the appropriate default partitions and metadata partitions*/
                _partitionMetaDataEntityWrapper = new TableEntityWrapper <PartitionMetaData>(CtConstants.TableMetaDataPartitionKey,
                                                                                             CtConstants.PartitionSchemasRowKey);
                DefaultIndex = CreateIndexDefinition(_defaultIndexDefinitionName)
                               .DefineIndexCriteria(entity => true)
                               .SetIndexedPropertyCriteria(entity => entity.GetType().Name); // Enables searching directly on the type
                AddIndexDefinition(DefaultIndex);
            }
        }