Cleaned code for adding attachments

It was originally inspired by Exchange plugin which implements
a lot of functionality by itself. But we don't need that, it's already
implemented by lightning.