I am curious to know how to use dividends data in QC

Say on the day that SPY issues dividend, and I hold 100 shares of SPY, I would like to see the cash in my portfolio increases. I know there is a dividends data event, should I do something like this:

public void OnData(Dividends data)

{

Portfolio.Cash = Portfolio.Cash + 100*Securities["SPY"].Dividend

}

I know this is funky, but anyone has a sample showing how to use this event handler?