Repository systems handle the management of metadata and metamodels. They act as data store with a custom-defined and dynamically adaptable system catalogue. This feature finds a useful application in systems such as process engines, collaborative and information systems, CASE tools and transformation engines, in which custom-defined catalogues are rarely available due to their complex nature. In this context repositories would improve those systems' ability to adapt and allow for dynamic information discovery. Preserving the consistency of the repository data is a major challenge. Repository consistency has several aspects, the most important of which is structural consistency. It is insufficiently specified in the metadata and repository standards, and is incompletely implemented in existing systems. In this paper we propose a novel approach to enforcing structural consistency in MOF-based repositories. We describe its implementation in iRM/RMS -a prototypical OMG MOFbased repository system [35]. We show how this algorithm overcomes the deficiencies of the existing approaches and products.