public function getRepository($class)
    {
        //If a repository doesn't exist for this class, make a new one!
        if(!isset($this->repositories[$class]))
        {
            //Get meta info for the class
            $meta = $this->metaRepository->fromClass($class);

            //Get the repository class and make a new instance of that class
            $repositoryClass = $meta->getRepositoryClass();
            $repository = new $repositoryClass($this, $meta);

            //Make sure you're extending repository.
            if(!($repository instanceof Repository)) {
                throw new Exception("Requested repository class $repositoryClass does not extend the base repository class.");
            }

            //Save the repo
            $this->repositories[$class] = $repository;
        }

        return $this->repositories[$class];
    }