Implementing cake pattern for dependency injection