private static Core2User BuildUser(JObject body) { if (body[AttributeNames.Schemas] == null) { throw new ArgumentException(AttributeNames.Schemas); } JEnumerable <JToken> schemas = body[AttributeNames.Schemas].Children(); Core2User item; if (schemas.Contains(SchemaIdentifiers.Core2EnterpriseUser)) { item = body.ToObject <Core2EnterpriseUser>(); } else { item = body.ToObject <Core2User>(); } return(item); }