How Do Banks Respond to Shocks? A Dynamic Model of Deposit-Taking Institutions