/// <summary>
 /// Creates a new Track instance filled with the values found in the specified record.
 /// </summary>
 /// <param name="row">The record containing the track information</param>
 public Track(Record row)
 {
     Title = GetStringValue(row, MetadataField.Title);
     Album = GetStringValue(row, MetadataField.Album);
     Artist = GetStringValue(row, MetadataField.Artist);
     AlbumArtist = GetStringValue(row, MetadataField.AlbumArtist);
     PlayCount = GetIntValue(row, MetadataField.PlayCount, 0);
     Rating = GetIntValue(row, MetadataField.Rating);
 }
        private int GetIntValue(Record row, MetadataField fieldType, int defaultValue)
        {
            int? val = GetIntValue(row, fieldType);
            if (val.HasValue)
                return val.Value;

            return defaultValue;
        }
 private string GetStringValue(Record row, MetadataField fieldType)
 {
     StringField field = (StringField) row.GetFieldByType(fieldType);
     if (field != null)
         return field.Value;
     return null;
 }
 private int? GetIntValue(Record row, MetadataField fieldType)
 {
     IntegerField field = (IntegerField) row.GetFieldByType(fieldType);
     if (field != null)
         return field.Value;
     return null;
 }