I think this method is really too long and break npath and cyclomatic complexity