EnsureRepository returns a IRepository. You could use that. Additionally every call to GetRepository does file system look ups so it might make sense to not have it be called multiple times