def create_build(version, api, record):
    """
    Create the build object.
    If we're recording it, save it to the DB.
    Otherwise just use an empty hash.
    """
    if record:
        # Create Build Object.
        build = api.build.post(dict(
            project='/api/v1/project/%s/' % version.project.pk,
            version='/api/v1/version/%s/' % version.pk,
            type='html',
            state='triggered',
        ))
    else:
        build = {}
    return build