Refactor alerts service to a factory an unified factory structure