private static function insert(Message $model) { $db = DatabaseData::getInstance(\RedDevil\Config\DatabaseConfig::DB_INSTANCE); $query = "INSERT INTO messages (SenderId,RecipientId,Content,CreatedOn) VALUES (:SenderId, :RecipientId, :Content, :CreatedOn);"; $result = $db->prepare($query); $result->execute([':SenderId' => $model->getSenderId(), ':RecipientId' => $model->getRecipientId(), ':Content' => $model->getContent(), ':CreatedOn' => $model->getCreatedOn()]); $model->setId($db->lastInsertId()); }