refactored destroy action in posts controller