def METHOD_NAME(req):
    if req.method == 'POST':
        profile = get_user_profile(req.user)
        profile_form = ProfileForm(req.POST, instance=profile)
        license_form = LicenseForm(req.POST, instance=profile.default_license)
        if profile_form.is_valid() and license_form.is_valid():
            profile_form.save()
            license,created = License.objects.get_or_create(
                default_license=License.get_default(),
                allow_commercial_use=license_form.cleaned_data['allow_commercial_use'],
                allow_modifications=license_form.cleaned_data['allow_modifications'],
            )
            profile.default_license = license
            profile.save()
            messages.success(req, 'Profile successfully updated.')
        else:
            store_session_form(req.session, ProfileForm, req.POST)
            store_session_form(req.session, LicenseForm, req.POST)
            messages.error(req, 'Please fix the following errors:')
        return redirect('astrometry.net.views.user.dashboard_profile')