public static function castEntry($entry, $model)
    {
        if (!$entry) {
            return $entry;
        }

        $timestamp_format = \Phramework\Phramework::getSetting(
            'timestamp_format',
            null,
            'Y-m-d\TH:i:s\Z'
        );

        //Repeat for each model's attribute of the entry.
        //$k holds the key of the attribute and $v the type
        foreach ($model as $k => $v) {
            if (!isset($entry[$k])) {
                continue;
            }

            //Typecast
            Filter::typecast($entry[$k], $v);

            //if type is a Validate::TYPE_UNIX_TIMESTAMP
            //then inject a string version of the timestamp to this entry
            if ($v === Validate::TYPE_UNIX_TIMESTAMP) {
                //offset included!
                $converted = gmdate($timestamp_format, $entry[$k]);

                //inject the string version of the timestamp
                $entry[$k . '_formatted'] = $converted;
            }
        }

        return $entry;
    }