/// <summary>
        /// Gets identity resources by scope name.
        /// </summary>
        /// <param name="scopeNames"></param>
        /// <returns></returns>
        public Task <IEnumerable <IdentityResource> > FindIdentityResourcesByScopeAsync(IEnumerable <string> scopeNames)
        {
            var scopes = scopeNames.ToArray();

            var results = IdentityResources.FindByScopeNames(scopes);

            _logger.LogDebug("Found {scopes} identity scopes in database", results.Select(x => x.Name));

            return(Task.FromResult(results.Select(x => x.ToModel()).ToArray().AsEnumerable()));
        }
        /// <summary>
        /// Gets all resources.
        /// </summary>
        /// <returns></returns>
        public Task <Resources> GetAllResourcesAsync()
        {
            var identity = IdentityResources.FindAll();

            var apis = ApiResources.FindAll();

            var result = new Resources(
                identity.ToArray().Select(x => x.ToModel()).AsEnumerable(),
                apis.ToArray().Select(x => x.ToModel()).AsEnumerable());

            _logger.LogDebug("Found {scopes} as all scopes in database", result.IdentityResources.Select(x => x.Name).Union(result.ApiResources.SelectMany(x => x.Scopes).Select(x => x.Name)));

            return(Task.FromResult(result));
        }