internal static IRepository GetRepositoryByName(IDictionary<string, string> parameters,
string repoName)
{
var repos = GetRepositories(parameters);
var correctRepo = from rep in repos where rep.Name.Equals(repoName) select rep;
var numFound = correctRepo.Count();
if (numFound == 0)
{
throw new ArgumentException(String.Format("Repository '{0}' does not exist",
repoName));
}
else if (numFound > 1)
{
throw new ArgumentException(String.Format("Multiple repositories with name '{0}'",
repoName));
}
return correctRepo.First();
}