Refactor rails service if statements.