def METHOD_NAME():
    log = {}
    log['updatedReleases'] = []
    print 'Getting all releases'
    all_releases = db.find(all_releases_query)
    print 'Received ' + str(len(all_releases)) + ' releases'
    for release in all_releases:
        attachmentTypeMatched = False
        attachmentAccepted = False
        if release.get("attachments") is not None:
            for attachmentInfo in release.get("attachments"):
                if attachmentInfo.get("attachmentType") == "COMPONENT_LICENSE_INFO_XML" or attachmentInfo.get("attachmentType") == "CLEARING_REPORT":
                    attachmentTypeMatched = True
                    if attachmentInfo.get("checkStatus") == "ACCEPTED":
                        attachmentAccepted = True
                        break
        updatedReleaseLog = {}
        isClearingStateUpdated = False;
        if attachmentTypeMatched and attachmentAccepted:
            isClearingStateUpdated = setClearingStateIfDifferent(release, "APPROVED", updatedReleaseLog)
        elif attachmentTypeMatched:
            isClearingStateUpdated = setClearingStateIfDifferent(release, "REPORT_AVAILABLE", updatedReleaseLog)
        elif release.get('clearingState') != "SENT_TO_CLEARING_TOOL" and release.get('clearingState') != "UNDER_CLEARING":
            isClearingStateUpdated = setClearingStateIfDifferent(release, "NEW_CLEARING", updatedReleaseLog)
        if isClearingStateUpdated: 
            print '\tUpdating release ID -> ' + release.get('_id') + ', Release Name -> ' + release.get('name') + ', Release Version -> ' + release.get('version') + ', Old Clearing State -> ' + str(updatedReleaseLog['oldClearingState']) + ', New Clearing State -> ' + str(updatedReleaseLog['newClearingState'])
            updatedReleaseLog['id'] = release.get('_id')
            updatedReleaseLog['name'] = release.get('name')
            updatedReleaseLog['version'] = release.get('version')
            log['updatedReleases'].append(updatedReleaseLog)
            if not DRY_RUN:
                db.save(release)
    resultFile = open('004_recompute_clearing_state_of_release.log', 'w')
    json.dump(log, resultFile, indent = 4, sort_keys = True)
    resultFile.close()
    print '\n'
    print '------------------------------------------'
    print 'Total Releases updated : ' + str(len(log['updatedReleases']))
    print '------------------------------------------'
    print 'Please check log file "004_recompute_clearing_state_of_release.log" in this directory for details'
    print '------------------------------------------'