private async Task <List <IGym> > GetGymsByNameAsync(string name, FenceConfiguration[] fences = null)
        {
            Dictionary <string, int> aliasCache = new Dictionary <string, int>();

            aliasCache.Add("spital", 37);
            aliasCache.Add("reha", 36);

            if (aliasCache.ContainsKey(name.ToLower()))
            {
                var gymId = aliasCache[name.ToLower()];
                return(await Task.FromResult(GymRepository.FindAll(e => e.Id == gymId).ToList()));
            }
            else
            {
                if (fences != null && fences.Any())
                {
                    var fortIds = new List <int>();
                    foreach (var fence in fences)
                    {
                        var ids = GymsByFences.GetOrAdd(fence, GetFortIdsForFence);
                        fortIds.AddRange(ids);
                    }
                    fortIds = fortIds.Distinct().ToList();

                    return(await GymRepository.FindAll(e => fortIds.Contains(e.Id) && e.Name.Contains(name)).ToListAsync());
                }
                else
                {
                    return(await GymRepository.FindAll(e => e.Name.Contains(name)).ToListAsync());
                }
            }
        }
        private IQueryable <IGym> GetGyms(FenceConfiguration[] fences = null)
        {
            if (fences != null && fences.Any())
            {
                var fortIds = new List <int>();
                foreach (var fence in fences)
                {
                    var ids = GymsByFences.GetOrAdd(fence, GetFortIdsForFence);
                    fortIds.AddRange(ids);
                }
                fortIds = fortIds.Distinct().ToList();

                return(GymRepository.FindAll(e => fortIds.Contains(e.Id)));
            }
            return(GymRepository.GetAll());
        }