public static FacebookUser CreateFromDynamic(dynamic data, AccountFacebook ReceivingAccount) { if (data != null) { FacebookUser user = new FacebookUser(); user.Id = data.id; user.FullName = data.name; if (data.username == null && data.first_name == null && ReceivingAccount != null) { data = (IDictionary <string, object>)ReceivingAccount.facebookClient.Get(user.Id); } user.FirstName = data.first_name; user.LastName = data.last_name; user.MiddleName = data.middle_name; if (data.gender != null) { if (data.gender == "female") { user.Gender = Genders.Female; } } user.Locale = data.locale; user.ProfileLink = data.link; user.Username = data.username; user.ThirdPartyId = data.third_party_id; if (data.timezone != null) { try { user.Timezone = data.timezone; } catch { user.Timezone = 0; } } DateTime tempUpdated; DateTime.TryParse(data.updated_time, out tempUpdated); user.UpdatedTime = tempUpdated; bool tempVerified = false; try { if (data.verified != null) { string verifyString = data.verified as string; if (verifyString != null) { if (verifyString.ToLower() == "true") { user.Verified = true; } } } // Boolean.TryParse(data.verified, out tempVerified); // much better code - but throws to many exception } catch { } user.Verified = tempVerified; user.Bio = data.bio; DateTime tempBirthday; DateTime.TryParse(data.birthday, out tempBirthday); user.Birthday = tempBirthday; user.Email = data.email; // this.HomeTown = data.hometown; user.Political = data.political; user.Quotes = data.quotes; user.RelationshipStatus = data.releationship_status; user.Religion = data.religion; user.Website = data.website; return(user); } else { return(null); } }