Most of the code is taken from put_own_property however the attributes need to be handled slightly differently it seems