protected function prepareForDatabase($property, $value)
    {
        $type = $this->getPropertyType($property);

        if ($type == 'array' && is_array($value)) {
            return implode(",", $value);
        }
        if (is_bool($value)) {
            $value = (int) $value;
        }

        return $value;
    }