Problem with switch case approach is, if factory is huge then there will be a performance cost to find matching id. I was using array approach to avoid that.