private Pet RetrievePetFromPrivateDomain() { string domainToTry = this._domainName; GetAttributesRequest getAttributeRequest = null; GetAttributesResult result; List<Attribute> attrs = null; if (DomainHelper.DoesDomainExist(this._domainName, _simpleDBClient)) { // // Try to get the requested pet from the user's private domain // getAttributeRequest = new GetAttributesRequest() .WithDomainName(this._domainName) .WithItemName(this._itemName); result = _simpleDBClient.GetAttributes(getAttributeRequest).GetAttributesResult; if (result != null) { if (result.Attribute.Count > 0) { attrs = result.Attribute; } else { // If we can't find it try the public domain getAttributeRequest.WithDomainName(Properties.Settings.Default.PetBoardPublicDomainName); result = _simpleDBClient.GetAttributes(getAttributeRequest).GetAttributesResult; if (result != null) { attrs = result.Attribute; } } } } else if (DomainHelper.DoesDomainExist(Settings.Default.PetBoardPublicDomainName, _simpleDBClient)) { getAttributeRequest = new GetAttributesRequest() .WithDomainName(Properties.Settings.Default.PetBoardPublicDomainName) .WithItemName(this._itemName); result = _simpleDBClient.GetAttributes(getAttributeRequest).GetAttributesResult; if (result != null) { attrs = result.Attribute; } } // If results is null, attrs is going to be null as well if (attrs != null) { return new Pet { PhotoThumbUrl = attrs.First(a => a.Name == "PhotoThumbUrl").Value, Name = attrs.First(a => a.Name == "Name").Value, Birthdate = attrs.First(a => a.Name == "Birthdate").Value, Sex = attrs.First(a => a.Name == "Sex").Value, Type = attrs.First(a => a.Name == "Type").Value, Breed = attrs.First(a => a.Name == "Breed").Value, Likes = attrs.First(a => a.Name == "Likes").Value, Dislikes = attrs.First(a => a.Name == "Dislikes").Value }; } else { return null; } }