Extract common controller behaviour