This method exceeds the cyclomatic complexity limit and should be refactored.