added count method to model.