'Stores data to IMAP server
Arguments:
- imapobj: instance of IMAPlib to use
- uid: message UID
- field: field name to be stored/updated
- data: field contents'

def _store_to_imap(self, imapobj, uid, field, data):

    imapobj.select(self.getfullname())
    (res_type, retdata) = imapobj.uid('store', uid, field, data)
    if (res_type != 'OK'):
        severity = OfflineImapError.ERROR.MESSAGE
        reason = ("IMAP    server    '%s'    failed    to    store    %s    for    message    UID    '%d'.Server    responded:    %s    %s" % (self.getrepository(), field, uid, res_type, retdata))
        raise OfflineImapError(reason, severity)
    return retdata[0]
