public function createFromDatabaseValues($data, $entity = null)
    {
        $entity = $this->getEntity($entity);
        $fields = $this->getFields();

        // set fields
        foreach ($fields as $key => $mapping) {
            $fieldType = $this->fieldManager->get($mapping['fieldtype'], $mapping);
            if ($fieldType instanceof FieldTypeInterface) {
                $fieldType->hydrate($data, $entity);
            }
        }

        return $entity;
    }