title: Realm Model Conversion Failed
body: <p>I have a realm db model like:</p>
  
  <pre><code>import RealmSwift
  
  class User: Object {
  
      let isVerified = RealmOptional&lt;Bool&gt;()   
      @objc dynamic var pk = 0
      @objc dynamic var profilePicUrl: String? = nil
  }
  </code></pre>
  
  <p>And I am getting data from service and it returns same name and type like realm model.</p>
  
  <p>I want to save this data to db. But when I try to convert model to <code>realm model</code> it gives error.</p>
  
  <pre><code>let data = [Users(value: serviceUser)] -&gt; serviceUser comes from service.
  </code></pre>
  
  <p>Before save when I try to convert I get this error:</p>
  
  <blockquote>
    <p>'RLMException', reason: 'Invalid value 'ServiceUserModel(isVerified: Optional(false), pk: Optional(123456), profilePicUrl: Optional("") of type '__UserDataValue' for 'bool' property 'Users.isVerified'.'</p>
  </blockquote>
  
  <p>serviceUser Model:</p>
  
  <pre><code>public struct ServiceUserModel: Codable {
      public var isVerified: Bool?    
      public var pk: Int?
      public var profilePicUrl: String?
  }
  </code></pre>
  
  <p>I do not want to use <code>for</code> loop because of performance problem. I want to save this data in one time.</p>
  
  <p>Save Method:</p>
  
  <pre><code>func save(users: [Users]){
  
          try! database.write {
              database.add(users)
          }
      }
  </code></pre>
  
  <p>How can I convert it?</p>