[#71713116] Refactored to remove duplication in setting the session

Signed-off-by: Ellie Schneiders <ems2141@gmail.com>