public static SmartProperty GetReturnProperty(this SmartObject smartObject, string propertyName)
        {
            var returnProperties = smartObject.GetReturnProperties();

            if (returnProperties.Count == 0)
            {
                throw new Exception(string.Concat(smartObject.Name, "SmartObject did not have any return properties."));
            }

            if (string.IsNullOrEmpty(propertyName))
            {
                return(returnProperties[0]);
            }
            else
            {
                var returnProperty = returnProperties.OfType <SmartProperty>()
                                     .Where(i => i.Name.StartsWith(propertyName, StringComparison.InvariantCultureIgnoreCase))
                                     .FirstOrDefault();

                if (returnProperty == null)
                {
                    throw new Exception(string.Concat("Could not find return property ", propertyName, " on SmartObject ", smartObject.Name));
                }

                return(returnProperty);
            }
        }