implement delete attachment function