<?php
/**
 * Checks if there are options already present from Moment free version and adds it to the Moment theme options
 *
 * @since Moment 2.0.2
 * @hook after_theme_switch
 */
function moment_setup_options() {
    //Perform action only if theme_mods_moment[moment-options] does not exist
    if( !get_theme_mod( 'moment-options' ) ) {
        //Perform action only if theme_mods_moment free version exists
        if ( $moment_free_options = get_option ( 'theme_mods_moment' ) ) {
            if ( isset( $moment_free_options['moment-options'] ) ) {
                global $moment_customizer_defaults;
                $moment_pro_default_options = $moment_customizer_defaults;

                $moment_theme_options = $moment_free_options;

                $moment_theme_options['moment-options'] = array_merge( $moment_pro_default_options , $moment_free_options['moment-options'] );

                update_option('theme_mods_moment', $moment_theme_options );
            }
        }
    }
}

add_action('after_switch_theme', 'moment_setup_options');