Add support for custom HATEOAS

Updated the code in order to don't overwrite '_self' and 'self' if already exists in doc.