'Returns the version that was promoted to be the new stable version
Return ``None`` if no update was mode or if there is no version on the
project that can be considered stable.'

def update_stable_version(self):

    versions = self.versions.all()
    new_stable = determine_stable_version(versions)
    if new_stable:
        current_stable = self.get_stable_version()
        if current_stable:
            identifier_updated = (new_stable.identifier != current_stable.identifier)
            if (identifier_updated and current_stable.machine):
                log.info('Update    stable    version:    {project}:{version}'.format(project=self.slug, version=new_stable.identifier))
                current_stable.identifier = new_stable.identifier
                current_stable.save()
                return new_stable
        else:
            log.info('Creating    new    stable    version:    {project}:{version}'.format(project=self.slug, version=new_stable.identifier))
            current_stable = self.versions.create_stable(type=new_stable.type, identifier=new_stable.identifier)
            return new_stable
