public Models.Workout.WorkoutAdvice GetById(int id)
        {
            var dbAdvice = _context.WorkoutAdvices
                           .Include(x => x.Client)
                           .ThenInclude(x => x.AppUser)
                           .Include(x => x.Trainer)
                           .ThenInclude(x => x.AppUser)
                           .Where(x => x.Id == id)
                           .FirstOrDefault();

            if (dbAdvice == null)
            {
                throw new ResourceNotFoundException($"Workour advice with id {id} not found");
            }

            return(WorkoutAdviceMapper.fromDb(dbAdvice));
        }
        public List <Models.Workout.WorkoutAdvice> GetAll(WorkoutAdviceQueryParams queryParams, UserInfo userInfo)
        {
            var query = _context.WorkoutAdvices
                        .Include(x => x.Client)
                        .ThenInclude(x => x.AppUser)
                        .Include(x => x.Trainer)
                        .ThenInclude(x => x.AppUser)
                        .AsQueryable();

            if (userInfo.Role == "EMPLOYEE")
            {
                if (queryParams.ClientId != null)
                {
                    query = query.Where(x => x.ClientId == queryParams.ClientId);
                }

                if (queryParams.TrainerId != null)
                {
                    query = query.Where(x => x.TrainerId == queryParams.TrainerId);
                }
            }

            else if (userInfo.Role == "TRAINER")
            {
                query = query.Where(x => x.TrainerId == userInfo.Id);
            }

            else
            {
                query = query.Where(x => x.ClientId == userInfo.Id);

                if (queryParams.TrainerId != null)
                {
                    query = query.Where(x => x.TrainerId == queryParams.TrainerId);
                }
            }

            return(query.Select(x => WorkoutAdviceMapper.fromDb(x))
                   .ToList());
        }