public async Task <MapModel> GetRandomMap(string previous = "")
        {
            var model = MapModel.FromEntity(await TableStorage.GetRandomMap(previous));

            Analytics.AddEventAsync("api.public.get.random", new
            {
                client_id = this.ClientId,
                request_param_previous = previous,
                map_id            = model.Id,
                map_title         = model.Title,
                map_author        = model.Author,
                map_year          = model.Year,
                map_image_url     = model.ImageAddress,
                map_reference_url = model.ReferenceAddress
            });

            return(model);
        }
        public async Task <MapModel> GetFeaturedMap()
        {
            MapModel model = MapModel.FromEntity(await TableStorage.GetFeaturedMap(DateTimeOffset.UtcNow));

            // If no featured map is set return a random one and set a short update check.
            if (model == null)
            {
                model = MapModel.FromEntity(await TableStorage.GetRandomMap());

                var nextHour = DateTimeOffset.UtcNow.AddHours(1) - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

                model.NextUpdate = (long)nextHour.TotalSeconds;

                Analytics.AddEventAsync("api.public.get.featured", new
                {
                    client_id         = this.ClientId,
                    map_id            = model.Id,
                    map_title         = model.Title,
                    map_author        = model.Author,
                    map_year          = model.Year,
                    map_image_url     = model.ImageAddress,
                    map_reference_url = model.ReferenceAddress,
                    next_update       = model.NextUpdate
                });

                return(model);
            }

            model.NextUpdate = Utils.NextFeaturedUpdateTime();

            Analytics.AddEventAsync("api.public.get.featured", new
            {
                client_id         = this.ClientId,
                map_id            = model.Id,
                map_title         = model.Title,
                map_author        = model.Author,
                map_year          = model.Year,
                map_image_url     = model.ImageAddress,
                map_reference_url = model.ReferenceAddress,
                next_update       = model.NextUpdate
            });

            return(model);
        }