public static function delete($id, $additionalAttributes, $table, $idAttribute = 'id', $limit = 1)
    {
        //force disable limit because they wont work with postgreqsql
        $limit = null;

        $queryValues = [$id];

        $additional = [];

        foreach ($additionalAttributes as $key => $value) {
            //push to additional
            $additional[] = sprintf(
                'AND "%s"."%s" = ?',
                $table,
                $key
            );
            $queryValues[] = $value;
        }

        $tableName = '';
        if (is_array($table) &&
            isset($table['schema']) &&
            isset($table['table'])) {
            $tableName = '"' . $table['schema'] . '"'
                .'."' . $table['table'] . '"';
        } else {
            $tableName = '"' . $table . '"';
        }

        $query = sprintf(
            'DELETE FROM %s
            WHERE "%s" = ?
              %s
              %s',
            $tableName,
            $idAttribute,
            implode("\n", $additional),
            (
                $limit === null
                ? ''
                : 'LIMIT ' . $limit
            )
        );

        return Database::execute($query, $queryValues);
    }