public static LineItem generate(Order order, int sequence, Product product, long quantity) { LineItem item = new LineItem(); item.order = order; item.sequence = sequence; item.product = product; item.quantity = quantity; item.order.LineItems.Insert(sequence, item); return item; }