Refactor request body validation