WIP: CS-5413

here we can just call count query for attachments