def METHOD_NAME():
    if request.method == "POST":
        connect_app = request.get_json(force=True)
        name = connect_app.get("name")
        if name and Application.get_app_by_name(name) is not None:
            return error(409, "An object with that name already exists.")
        title = connect_app["title"] if "title" in connect_app else ""
        return Application(
            name=name,
            title=title,
            owner_username=g.user.username,
            owner_first_name=g.user.first_name,
            owner_last_name=g.user.last_name,
            owner_email=g.user.email,
            owner_locked=g.user.locked,
            _base_url=url_for("index", _external=True),
        )
    else:
        count = int(request.args.get("count", 10000))
        search = request.args.get("search")
        def match(app_to_match):
            return search is None or app_to_match.title.startswith(search)
        matches = list(filter(match, Application.get_all_objects()))[:count]
        return {
            "count": len(matches),
            "total": len(matches),
            "applications": matches,
        }