Modelling biodiversity trends from occurrence records