public IEnumerable <ToyModel> GetToys(string orderBy) { if (!allowedSortValues.Contains(orderBy.ToLower())) { throw new Exceptions.BadOperationRequest($"bad sort value: { orderBy } allowed values are: { String.Join(",", allowedSortValues)}"); } var toyEntities = repository.GetToys(orderBy); return(mapper.Map <IEnumerable <ToyModel> >(toyEntities)); }