The main reason they're so similar is because both middleware need to check if the signed-in user is an admin, which requires access to that info from the DB. Maybe there's a way to store this data from the first middleware to cut this down a bit...