Manage attachments refactoring

Yet another refactoring PR :) 

I've skipped  action_repair(),  action_transfer() and pauseAttachmentsMaintenance for now. My coding is a little rusty, don't wanna break too much at the same time ;-)