A pattern for enabling multitenancy in legacy application