public async Task <EntityList> InstallSchemaAsync(IApiContext apiContext, EntityList entityList, EntityScope scope,
                                                          IndexedProperty idProperty, List <IndexedProperty> indexedProperties)
        {
            if (indexedProperties != null && indexedProperties.Count > 4)
            {
                throw new Exception("Only 4 indexed properties are supported");
            }
            if (string.IsNullOrEmpty(entityList.Name))
            {
                throw new Exception("Entity name is missing");
            }

            entityList.TenantId     = apiContext.TenantId;
            entityList.ContextLevel = scope.ToString();

            if (indexedProperties != null)
            {
                entityList.IndexA = indexedProperties.Count >= 1 ? indexedProperties[0] : null;
                entityList.IndexB = indexedProperties.Count >= 2 ? indexedProperties[1] : null;
                entityList.IndexC = indexedProperties.Count >= 3 ? indexedProperties[2] : null;
                entityList.IndexD = indexedProperties.Count >= 4 ? indexedProperties[3] : null;
            }

            if (idProperty == null)
            {
                entityList.UseSystemAssignedId = true;
            }
            else
            {
                entityList.IdProperty = idProperty;
            }

            if (string.IsNullOrEmpty(entityList.NameSpace))
            {
                entityList.NameSpace = _appSetting.Namespace;
            }

            var entityListResource = new EntityListResource(apiContext);
            var listFQN            = GetListFQN(entityList.Name, entityList.NameSpace);
            var existing           = await GetEntityListAsync(apiContext, entityList.Name);

            try
            {
                existing = existing != null
                    ? await entityListResource.UpdateEntityListAsync(entityList, listFQN)
                    : await entityListResource.CreateEntityListAsync(entityList);
            }
            catch (AggregateException ae)
            {
                if (ae.InnerException.GetType() == typeof(ApiException))
                {
                    throw;
                }
                var aex = (ApiException)ae.InnerException;
                _logger.Error(aex.Message, aex);
                throw aex;
            }

            return(entityList);
        }
        public async Task <EntityList> GetEntityListAsync(IApiContext apiContext, String name, string nameSpace)
        {
            var        entityListResource = new EntityListResource(apiContext);
            String     listFQN            = GetListFQN(name, nameSpace);
            EntityList entityList         = null;

            try
            {
                entityList = await entityListResource.GetEntityListAsync(listFQN);
            }
            catch (AggregateException ae)
            {
                if (ae.InnerException.GetType() == typeof(ApiException))
                {
                    throw;
                }
                var aex = (ApiException)ae.InnerException;
                _logger.Error(aex.Message, aex);
                throw aex;
            }
            return(entityList);
        }