I have a simple module with custom entity and I wanted to implement service contracts. I've read some articles about it and watched the course on Magento U (Fundamentals of Magento 2 development). According to the course, Data API should be implemented to a separate class contatining only data -> \Vendor\Module\Model\Data\Entity (not \Vendor\Module\Model\Entity) should implement the \Vendor\Module\Api\Data\EntityInterface, and all the functions in the Repository class should "work" on the Data\Entity class, for example get() function returns the Data\Entity class.
The issue I'm facing, in controller I need to check if the entity is new or one of the fields are changed, in \Magento\Framework\Model\AbstractModel there are functions that could handle this, but as the Data\Entity does not extend the AbstractModel I don't have access to this functions. Should I create a Service API in the module and create functions for this (basicly copy them from AbstractModel) or there is some other proper way. Could anyone point me in the right direction?
BTW is there any usage of entity models in service contracts pattern? The getters/setters are moved to Data API, the save/load are moved to Repositories and the bussines logic is moved to Service API, what's left?