Added optimization for agenda detail access to offload authorization test to a count query

WIP agenda detail optimization

Agenda detail optimization and added test for unauthorized agenda access