public static void UpdateTemplate(Rock.Client.DefinedValue templateDefinedValue, OnTemplateUpdated onUpdated)
        {
            // get the Type and Specific Ids so we can request this specific template.
            int typeId   = TemplateTypeId(templateDefinedValue);
            int uniqueId = TemplateUniqueId(templateDefinedValue);

            FamilyManagerApi.GetConfigurationTemplates(typeId, uniqueId,
                                                       delegate(System.Net.HttpStatusCode statusCode, string statusDescription, List <Rock.Client.DefinedValue> definedValueModels)
            {
                if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true && definedValueModels != null && definedValueModels.Count > 0)
                {
                    // extract the ConfigurationTemplate itself from both, and compare them.
                    ConfigurationTemplate currentTemplate = Template(templateDefinedValue);
                    currentTemplate.SortAttributeLists( );

                    ConfigurationTemplate downloadedTemplate = Template(definedValueModels[0]);
                    downloadedTemplate.SortAttributeLists( );

                    // is it different?
                    string currentVersion    = JsonConvert.SerializeObject(currentTemplate);
                    string downloadedVersion = JsonConvert.SerializeObject(downloadedTemplate);

                    if (string.Compare(currentVersion, downloadedVersion) != 0)
                    {
                        // they're different, so provide the latest one
                        onUpdated(true, definedValueModels[0]);
                    }
                    else
                    {
                        onUpdated(true, null);
                    }
                }
                else
                {
                    onUpdated(false, null);
                }
            });
        }
        public static void UpdateTemplate( Rock.Client.DefinedValue templateDefinedValue, OnTemplateUpdated onUpdated )
        {
            // get the Type and Specific Ids so we can request this specific template.
            int typeId = TemplateTypeId( templateDefinedValue );
            int uniqueId = TemplateUniqueId( templateDefinedValue );

            FamilyManagerApi.GetConfigurationTemplates( typeId, uniqueId,
                delegate(System.Net.HttpStatusCode statusCode, string statusDescription, List<Rock.Client.DefinedValue> definedValueModels )
                {
                    if( Rock.Mobile.Network.Util.StatusInSuccessRange( statusCode ) == true && definedValueModels != null && definedValueModels.Count > 0 )
                    {
                        // extract the ConfigurationTemplate itself from both, and compare them.
                        ConfigurationTemplate currentTemplate = Template( templateDefinedValue );
                        currentTemplate.SortAttributeLists( );

                        ConfigurationTemplate downloadedTemplate = Template( definedValueModels[ 0 ] );
                        downloadedTemplate.SortAttributeLists( );

                        // is it different?
                        string currentVersion = JsonConvert.SerializeObject( currentTemplate );
                        string downloadedVersion = JsonConvert.SerializeObject( downloadedTemplate );

                        if ( string.Compare( currentVersion, downloadedVersion ) != 0 )
                        {
                            // they're different, so provide the latest one
                            onUpdated( true, definedValueModels[ 0 ] );
                        }
                        else
                        {
                            onUpdated( true, null );
                        }
                    }
                    else
                    {
                        onUpdated( false, null );
                    }
                } );
        }