implemented generic write operation for attributes