private Release ParseRelease(XElement node)
{
int tracks;
string id, title, country;
TryParseChild(node, "id", out id);
TryParseChild(node, "title", out title);
TryParseChild(node, "country", out country);
TryParseChild(node, "track_count", 0, out tracks);
var e = node.Element("date");
var date = DateTime.MinValue;
if (e != null)
{
int year, month, day;
TryParseChild(e, "year", 1, out year);
TryParseChild(e, "month", 1, out month);
TryParseChild(e, "day", 1, out day);
date = new DateTime(year, month, day);
}
var release = new Release(id, title, country, date, tracks);
e = node.Element("artists");
if (e != null)
{
var list = e.Elements("artist");
foreach (var item in list)
{
release.Artists.Add(ParseArtist(item));
}
}
return release;
}