Maybe refactor this common code into a method ?