What is the primary purpose of an accident investigation in an occupational safety and health context?