implemented writeOperation