separated logic to get recent posts