move clearing of attachmentsCache to new method