Remove duplicated code in Spaces Repository

[#65037890]