Add generic type in identity, fix entity validation