C# Really need help figuring out how to update position

So lets say I already have active position for 500 shares.

I want to add 50 more shares and cancel existing braket orders that are pending for Stop Loss Price, Stop Limit Price and Take Profit Limit Price.

After that I want to add brakets to already existing position on all 500 shares.

So I am placing another order for 50 shares. Cancelling all existing pending orders. How to add that braket for existing active position?

var orders = await alpacaTradingClient.ListOrdersAsync(new ListOrdersRequest());

        foreach (var order in orders)
        {
            await alpacaTradingClient.DeleteOrderAsync(order.OrderId);
        }

The bracket orders “legs” have the same size as the main order. It’s not possible to place the main order with a quantity equal to 50 and make take profit and stop loss orders with another size. All that you can do is to place simple order, wait for its execution, and place OneCancelOther order (Limit + Stop Limit pair) order for full position size. See more information about these order types on Wiki.

You are correct! I was looking at the wrong object…

for(int i=1; i< orders.Count; i++)
{
await alpacaTradingClient.DeleteOrderAsync(orders[i].OrderId);
}

ChangeOrderRequest chg = new ChangeOrderRequest(OrderId);
chg.Quantity = 550;
chg.LimitPrice = stop.NewStopLossLimitPrice;
await alpacaTradingClient.PatchOrderAsync(chg);

That returned exactly what you are talking about - cannot change quantity…