public void CreateFurnitureRequest(WoodFurnitureOrderModel model) { var ListOfAllItems = _woodWorkshopRepository.GetItemsByName(model.FullName); if (ListOfAllItems != null) { var ListsOfEqualsUserFurnitureOrders = ListOfAllItems.GroupBy(x => x.Date); foreach (var list in ListsOfEqualsUserFurnitureOrders) { if (list.Count() > 5) { throw new System.Exception("Users can't buy more than 5 item's in the same day "); } } } var woodFurniture = _mapper.Map <WoodFurnitureOrder>(model); _woodWorkshopRepository.Create(woodFurniture); }