<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete(self):
 """Delete a Record from the Repository will perform callbacks and run validations before deletion. Throws ObjectNotFoundError if the object was not found in the repository. """

        # Fetch Model class and connected repository from Repository Factory
        model_cls = repo_factory.get_model(self.__class__)
        repository = repo_factory.get_repository(self.__class__)

        try:
            if not self.state_.is_destroyed:
                # Update entity's data attributes
                repository.delete(model_cls.from_entity(self))

                # Set Entity status to saved
                self.state_.mark_destroyed()

            return self
        except Exception:
            # FIXME Log Exception
            raise