private Cart(CartId cartId, IReadOnlyCollection <CartItem> cartItems)
        {
            Require.NotNull(cartId, nameof(cartId));
            Require.NotNull(cartItems, nameof(cartItems));

            Id     = cartId;
            _items = cartItems.ToDictionary(i => i.ItemId, i => i);
        }
 public static Cart From(CartId cartId, IReadOnlyCollection <CartItem> cartItems)
 => new Cart(cartId, cartItems);
 public static Cart New()
 => new Cart(CartId.New(), Array.Empty <CartItem>());