/// <summary>
        /// Gets all available models for the specified site.
        /// </summary>
        /// <param name="siteId">The optional site id</param>
        /// <returns>The available models</returns>
        public async Task <IEnumerable <Alias> > GetAllAsync(Guid?siteId = null)
        {
            if (!siteId.HasValue)
            {
                var site = await _siteService.GetDefaultAsync().ConfigureAwait(false);

                if (site != null)
                {
                    siteId = site.Id;
                }
            }

            if (siteId.HasValue)
            {
                return(await _repo.GetAll(siteId.Value).ConfigureAwait(false));
            }
            return(null);
        }
        /// <summary>
        /// Checks if the given site id is empty, and if so
        /// gets the site id of the default site.
        /// </summary>
        /// <param name="siteId">The optional site id</param>
        /// <returns>The site id</returns>
        private async Task <Guid?> EnsureSiteIdAsync(Guid?siteId)
        {
            if (!siteId.HasValue)
            {
                var site = await _siteService.GetDefaultAsync().ConfigureAwait(false);

                if (site != null)
                {
                    return(site.Id);
                }
            }
            return(siteId);
        }
 /// <summary>
 /// Gets the default side.
 /// </summary>
 /// <returns>The modell, or NULL if it doesnt exist</returns>
 public static Site GetDefault(this SiteService service)
 {
     return(service.GetDefaultAsync().GetAwaiter().GetResult());
 }