A model based approach to analysing financial stability