* @param repository is the repository, where the team file is automatically added or updated,
* when the team file is registered.
* @return a TeamItem that has been created or updated in the repository.
*/
private TeamItem register(URL teamFileUrl, IRepositoryRoot root, IRepository repository) {
TeamItem item = null;
// Check if the team file is already registered in the repository
String friendlyUrl = UrlUtil.removeFileExtension(teamFileUrl.toString());
IRepositoryItem repositoryItem = repository.getItem(friendlyUrl);
if (repositoryItem instanceof TeamItem) {
item = (TeamItem) repositoryItem;
}
// If the team file has not been registered then create a new TeamItem based on the team file URL
if (item == null) {
item = new TeamItem(teamFileUrl, root);
}
// Add or update the item in the repository and return it
repository.addOrUpdateItem(item);
return item;