Refactored the UpdateAttachment method in the Database class so that it runs inside a RunInTransaction call.