Refactor create family context and fix related scenarios