public void Pack(IEnumerable <BaseContainer> Containers) { Containers = OrderContainers(Containers); foreach (var c in Containers) { var FirstTruckWhereItFits = Trucks.FirstOrDefault(x => x.Fits(c)); if (FirstTruckWhereItFits == null) { Trucks.Add(new Truck((Rectangle)TrucksCapacity.Clone())); var LastTruck = Trucks.Last(); LastTruck.Add(c); } else { FirstTruckWhereItFits.Add(c); continue; } } }